Skip to content

Commit 413541b

Browse files
bjohansebasclaude
andcommitted
test: let test:only take file arguments without losing the e2e exclusion
--testPathIgnorePatterns is variadic, so a positional file after `npm run test:only --` was consumed as another ignore pattern — silently excluding the very file being targeted (the = form appends all the same). The exclusion now lives in jest.config.js and lifts itself when a test/e2e path is requested explicitly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent cb7592d commit 413541b

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

jest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
// The browser e2e suites run serially through `npm run test:e2e` — excluded
2+
// here so the regular run stays parallel. The ignore lifts itself when a
3+
// test/e2e path is requested explicitly (a CLI flag would swallow positional
4+
// file arguments, --testPathIgnorePatterns being variadic).
5+
const runningE2E = process.argv.some((arg) => arg.includes("test/e2e"));
6+
17
module.exports = {
28
testEnvironment: "node",
39
collectCoverage: false,
410
coveragePathIgnorePatterns: ["test", "<rootDir>/node_modules"],
511
moduleFileExtensions: ["js", "json"],
612
testMatch: ["**/test/**/*.test.js"],
13+
testPathIgnorePatterns: runningE2E ? [] : ["/node_modules/", "/test/e2e/"],
714
setupFilesAfterEnv: ["<rootDir>/setupTest.js"],
815
globalSetup: "./test/helpers/globalSetup.js",
916
snapshotResolver: "./test/helpers/snapshotResolver.js",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"build:code": "babel src -d dist --copy-files",
5050
"build:client": "babel client-src -d client --copy-files",
5151
"build": "npm-run-all -p \"build:**\"",
52-
"test:only": "node --experimental-vm-modules ./node_modules/jest-cli/bin/jest --testPathIgnorePatterns \"/test/e2e/\"",
52+
"test:only": "node --experimental-vm-modules ./node_modules/jest-cli/bin/jest",
5353
"test:e2e": "node --experimental-vm-modules ./node_modules/jest-cli/bin/jest test/e2e --runInBand",
5454
"test:watch": "npm run test:only -- --watch",
5555
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",

0 commit comments

Comments
 (0)