Node TAP
    Preparing search index...

    Class TapConfig<C>

    Class that handles configuration for TAP.

    Typically, @tapjs/config!index.TapConfig.load is the way to get one of these.

    Type Parameters

    Index

    Constructors

    • Type Parameters

      • C extends ConfigSet = { plugin: { default: string[]; description: string; hint: string } } & {
            plugin: ConfigOption<"string", true, undefined | readonly string[]>;
        } & {
            reporter: { description: string; hint: string; short: string };
            "reporter-file": { description: string; hint: string; short: string };
        } & {
            reporter: ConfigOption<"string", false, undefined | readonly string[]>;
            "reporter-file": ConfigOption<
                "string",
                false,
                undefined
                | readonly string[],
            >;
        } & { "reporter-arg": { description: string; hint: string; short: string } } & {
            "reporter-arg": ConfigOption<
                "string",
                true,
                undefined
                | readonly string[],
            >;
        } & {
            "coverage-report": {
                default: string[];
                description: string;
                hint: string;
            };
        } & {
            "coverage-report": ConfigOption<
                "string",
                true,
                undefined
                | readonly string[],
            >;
        } & {
            browser: { default: true; description: string };
            "no-browser": { description: string };
            "show-full-coverage": { description: string };
        } & {
            browser: ConfigOption<"boolean", false, undefined>;
            "no-browser": ConfigOption<"boolean", false, undefined>;
            "show-full-coverage": ConfigOption<"boolean", false, undefined>;
        } & { "coverage-map": { description: string; hint: string } } & {
            "coverage-map": ConfigOption<
                "string",
                false,
                undefined
                | readonly string[],
            >;
        } & {
            "allow-empty-coverage": { description: string };
            "allow-incomplete-coverage": { description: string };
            "disable-coverage": { description: string };
        } & {
            "allow-empty-coverage": ConfigOption<"boolean", false, undefined>;
            "allow-incomplete-coverage": ConfigOption<"boolean", false, undefined>;
            "disable-coverage": ConfigOption<"boolean", false, undefined>;
        } & {
            bail: { description: string; short: string };
            changed: { description: string; short: string };
            color: { description: string; short: string };
            comments: { description: string };
            "fail-only": { description: string };
            "fail-skip": { description: string };
            "fail-todo": { description: string };
            "no-bail": { description: string; short: string };
            "no-color": { description: string; short: string };
            passes: { description: string };
        } & {
            bail: ConfigOption<"boolean", false, undefined>;
            changed: ConfigOption<"boolean", false, undefined>;
            color: ConfigOption<"boolean", false, undefined>;
            comments: ConfigOption<"boolean", false, undefined>;
            "fail-only": ConfigOption<"boolean", false, undefined>;
            "fail-skip": ConfigOption<"boolean", false, undefined>;
            "fail-todo": ConfigOption<"boolean", false, undefined>;
            "no-bail": ConfigOption<"boolean", false, undefined>;
            "no-color": ConfigOption<"boolean", false, undefined>;
            passes: ConfigOption<"boolean", false, undefined>;
        } & { save: { description: string; hint: string; short: string } } & {
            save: ConfigOption<"string", false, undefined | readonly string[]>;
        } & { diag: { description: string }; "no-diag": { description: string } } & {
            diag: ConfigOption<"boolean", false, undefined>;
            "no-diag": ConfigOption<"boolean", false, undefined>;
        } & {
            timeout: {
                default: number;
                description: string;
                hint: string;
                short: string;
            };
        } & {
            timeout: ConfigOption<"number", false, undefined | readonly number[]>;
        } & { files: { description: string; hint: string } } & {
            files: ConfigOption<"string", true, undefined | readonly string[]>;
        } & {
            jobs: {
                default: number;
                description: string;
                hint: string;
                short: string;
            };
        } & { jobs: ConfigOption<"number", false, undefined | readonly number[]> } & {
            after: { description: string; hint: string };
            before: { description: string; hint: string };
            "output-dir": { description: string; hint: string; short: string };
            "output-file": { description: string; hint: string; short: string };
        } & {
            after: ConfigOption<"string", false, undefined | readonly string[]>;
            before: ConfigOption<"string", false, undefined | readonly string[]>;
            "output-dir": ConfigOption<"string", false, undefined | readonly string[]>;
            "output-file": ConfigOption<"string", false, undefined | readonly string[]>;
        } & {
            exclude: { default: string[]; description: string; hint: string };
            include: { default: string[]; description: string; hint: string };
            "node-arg": { default: never[]; description: string; hint: string };
            serial: { description: string; hint: string };
            "test-arg": { default: never[]; description: string; hint: string };
            "test-env": { default: never[]; description: string; hint: string };
        } & {
            exclude: ConfigOption<"string", true, undefined | readonly string[]>;
            include: ConfigOption<"string", true, undefined | readonly string[]>;
            "node-arg": ConfigOption<"string", true, undefined | readonly string[]>;
            serial: ConfigOption<"string", true, undefined | readonly string[]>;
            "test-arg": ConfigOption<"string", true, undefined | readonly string[]>;
            "test-env": ConfigOption<"string", true, undefined | readonly string[]>;
        } & {
            debug: { description: string };
            help: { description: string; short: string; type: "boolean" };
            "no-omit-whitespace": { description: string };
            "omit-version": { description: string };
            "omit-whitespace": { description: string };
            version: { description: string; short: string };
            versions: { description: string; short: string };
        } & {
            debug: ConfigOption<"boolean", false, undefined>;
            help: ConfigOption<"boolean", false, undefined>;
            "no-omit-whitespace": ConfigOption<"boolean", false, undefined>;
            "omit-version": ConfigOption<"boolean", false, undefined>;
            "omit-whitespace": ConfigOption<"boolean", false, undefined>;
            version: ConfigOption<"boolean", false, undefined>;
            versions: ConfigOption<"boolean", false, undefined>;
        }

      Parameters

      • jack: Jack<C> = ...

      Returns TapConfig<C>

    Properties

    configFile?: string

    The file providing configuration, either a package.json or .taprc. If undefined, it means that we don't have a config file.

    jack: Jack<C>

    The JackSpeak object representing TAP's configuration

    positionals?: string[]

    positional arguments to the TAP process

    projectRoot: string = cwd

    The effective current working directory for various globbing actions. The root of the project where a .taprc, package.json, or .git was found.

    testFileExtensions: Set<string> = testFileExtensions

    The file extensions that tap knows how to load, updated by plugins

    values?: OptionsResults<C>

    Parsed values in effect

    valuesFromConfigFile?: OptionsSubset<C>

    values read from the config file, if loaded

    Accessors

    • get pluginSignature(): string

      The signature of all plugin modules that ought to be loaded.

      Returns string

    Methods

    • load the file, and write the fields in data. If the file is not present, create it.

      Parameters

      • data: OptionsSubset<C>
      • configFile: undefined | string = ...
      • overwrite: boolean = false

      Returns Promise<void>

    • Edit the "tap" section of a package.json file

      Parameters

      Returns Promise<void>

    • Edit a yaml .taprc file

      Parameters

      Returns Promise<void>

    • replace __EXTENSIONS__ in a glob with the actual testFileExtensions

      Parameters

      • inc: string

      Returns string

    • Apply the extension from a resolved extends field in the config.

      Parameters

      • data: Record<string, any>
      • file: string

      Returns Promise<void>

    • Get a configuration value, as we currently know it

      Type Parameters

      • K extends string | number | symbol

      Parameters

      Returns OptionsResults<C>[K]

    • Load some configuration fields from a config file

      Parameters

      • data: any
      • configFile: string

      Returns Promise<
          TapConfig<C> & {
              configFile: string;
              valuesFromConfigFile: OptionsResults<C>;
          },
      >

    • Load configuration fields exported by active plugins

      Returns TapConfig<
          C & {
              only: {
                  description: string;
                  nodeArgs: (v: boolean) => string[];
                  short: string;
                  type: string;
              } & ConfigOption<"boolean", false, undefined>;
          } & { only: ConfigOption<"boolean", false, undefined> } & {
              grep: {
                  description: string;
                  hint: string;
                  multiple: boolean;
                  nodeArgs: (value: string[]) => string[];
                  short: string;
                  type: string;
              } & ConfigOption<"string", true, undefined | readonly string[]>;
          } & { grep: ConfigOption<"string", true, undefined | readonly string[]> } & {
              invert: { description: string; short: string; type: string } & ConfigOption<
                  "boolean",
                  false,
                  undefined,
              >;
          } & { invert: ConfigOption<"boolean", false, undefined> } & {
              "no-invert": { description: string; short: string; type: string } & ConfigOption<
                  "boolean",
                  false,
                  undefined,
              >;
          } & { "no-invert": ConfigOption<"boolean", false, undefined> } & {
              "filter-quietly": { description: string; type: string } & ConfigOption<
                  "boolean",
                  false,
                  undefined,
              >;
          } & { "filter-quietly": ConfigOption<"boolean", false, undefined> } & {
              "no-filter-quietly": { description: string; type: string } & ConfigOption<
                  "boolean",
                  false,
                  undefined,
              >;
          } & { "no-filter-quietly": ConfigOption<"boolean", false, undefined> } & {
              "save-fixture": { description: string; short: string; type: string } & ConfigOption<
                  "boolean",
                  false,
                  undefined,
              >;
          } & { "save-fixture": ConfigOption<"boolean", false, undefined> } & {
              snapshot: { description: string; short: string; type: string } & ConfigOption<
                  "boolean",
                  false,
                  undefined,
              >;
          } & { snapshot: ConfigOption<"boolean", false, undefined> } & {
              "snapshot-clean-cwd": {
                  default: boolean;
                  description: string;
                  type: string;
              } & ConfigOption<"boolean", false, undefined>;
          } & { "snapshot-clean-cwd": ConfigOption<"boolean", false, undefined> } & {
              "no-snapshot-clean-cwd": { description: string; type: string } & ConfigOption<
                  "boolean",
                  false,
                  undefined,
              >;
          } & { "no-snapshot-clean-cwd": ConfigOption<"boolean", false, undefined> } & {
              typecheck: { description: string; type: string } & ConfigOption<
                  "boolean",
                  false,
                  undefined,
              >;
          } & { typecheck: ConfigOption<"boolean", false, undefined> } & {
              tsconfig: { description: string; type: string } & ConfigOption<
                  "string",
                  false,
                  undefined
                  | readonly string[],
              >;
          } & {
              tsconfig: ConfigOption<"string", false, undefined | readonly string[]>;
          } & {
              "type-strip-only": { description: string; type: string } & ConfigOption<
                  "boolean",
                  false,
                  undefined,
              >;
          } & { "type-strip-only": ConfigOption<"boolean", false, undefined> },
      >

    • Parse the arguments and set configuration and positionals accordingly.

      Parameters

      • args: string[] = argv

      Returns TapConfig<C> & { positionals: string[]; values: OptionsResults<C> }

    • Read a package.json file

      Parameters

      • pj: string
      • silent: boolean = false

      Returns Promise<undefined | { tap?: OptionsResults<C> }>

    • Resolve the source of an extends field in TAP configs

      Parameters

      • ext: string
      • file: string

      Returns Promise<string>