Skip to content

test runner global configuration  #43895

Description

@MoLow

the question of global configuration for the test runner was raised on a few places,

I think it is worth a small discussion about how to provide the ability to globaly configure the test runner.

a few things that might have already been noted in the above links:

  • adding many cli flags dedicated for the test might be hard to maintain
  • test runner potentially runs in multiple processes so propagation of the global configuration needs to be considered

Activity

  1. added
    discussIssues opened for discussion and feedback.
    test_runnerIssues and PRs related to the test runner subsystem.
    on Jul 18, 2022
  2. MoLow commented on Jul 18, 2022

    @MoLow
    MemberAuthor

    @nodejs/test_runner
    @benjamingr

  3. MoLow commented on Jul 18, 2022

    @MoLow
    MemberAuthor

    my personal thoughts:
    It is preferable for global configuration to be a js file so it can contain js functions/objects (i.e for some of the use cases above such as reporters)
    one option is one single --test-config="file.js" flag to cover all configurations
    another option is looking for a .testrc file

  4. changed the title [-]test_runner: global configuration [/-] [+]test runner global configuration [/+] on Jul 18, 2022
  5. aduh95 commented on Jul 19, 2022

    @aduh95
    Contributor

    FWIW @nodejs/loaders is also brainstorming how to make configuration a thing in nodejs/loaders#98 (comment), maybe we can find a solution that works for both.

  6. Jamesernator commented on Aug 23, 2022

    @Jamesernator

    Specifying test files would be helpful too, at current the CLI shell expansions can be a bit limiting, for example using node --loader ts-node/esm --test **/*.test.ts will accidentally include files inside node_modules/. Being able to specify a test config with inclusions/exclusions would be considerably more helpful.

    A couple bikesheds:

    // maybe npm "files" like
    export default {
        loader: "ts-node/esm",
        files: [
            "**/*.test.ts",
            "!node_modules/",
        ],
    }
    
    // maybe tsconfig like
    export default {
       loader: "ts-node/esm",
       include: [
           "**/*.test.ts",
       ],
       exclude: [
           "node_modules/",
       ],
    }
  7. JakobJingleheimer commented on Aug 23, 2022

    @JakobJingleheimer
    Member

    I would expect the files to live in a specific directory like ./src, in which case, couldn't you do node --loader ts-node/esm --test ./src/**/*.test.ts

  8. Jamesernator commented on Aug 23, 2022

    @Jamesernator

    I would expect the files to live in a specific directory like ./src

    It's a common pattern, but not one I often use for multiple reasons.

  9. MoLow commented on Aug 24, 2022

    @MoLow
    MemberAuthor

    Specifying test files can now be done using #44241,
    closing this as this solves most of the use cases in this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussIssues opened for discussion and feedback.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions