vscode-jest-runner icon indicating copy to clipboard operation
vscode-jest-runner copied to clipboard

Supporting multiple config paths depending on the test file extension

Open sebekz opened this issue 2 years ago • 1 comments

Current state

I have multiple jest test suite types, each requiring different configuration files. Each suite type has a distinct file extension. For example:

  • integration tests - files ending with .int.test.ts - required -c configuration ./jest.config.int.js
  • end to end tests - files ending with .e2e.test.ts - required -c configuration ./jest.config.e2e.js
  • unit tests - files ending with .unit.test.ts - required -c configuration ./jest.config.js etc.

Unfortunately, vscode-jest-runner does not allow setting varying configuration files depending on file mask. I've also been using https://github.com/formulahendry/vscode-code-runner extension and I am able to have distinct configurations set there using the executorMapByGlob setting, i.e.

    "code-runner.executorMapByGlob": {
        "*.e2e.test.ts": "npx jest --config jest.config.e2e.js",
        "*.e2e.test.js": "npx jest --config jest.config.e2e.js",
        "*.int.test.ts": "npx jest --config jest.config.int.js",
        "*.int.test.js": "npx jest --config jest.config.int.js",
        "*.unit.test.ts": "npx jest",
        "*.unit.test.js": "npx jest",
        ...
    },

Expected state

It would be very helpful if one could designate multiple jest config files depending on the extension of the test file being executed.

sebekz avatar Mar 24 '23 08:03 sebekz

Is it the same feature as #309?

domsleee avatar Oct 15 '23 04:10 domsleee