From 646bafab99b4c4999c79db957d7f47f61ed15b8e Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sat, 27 Jan 2024 15:34:13 +0100 Subject: [PATCH] mocha: move spec to invocation If we specify the spec in the config file, we can't manually specify a specific test file from the cli. This is annoying, as the alternative is copying out the full package.json blurb into the shell. Rather, give the spec in the invocation and add a helper that makes testing a specific file simple. With this `yarn test:nospec test/plugins/link.ts` will only run tests within that file --- package.json | 3 ++- test/.mocharc.yml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4e32ff0e..609ea877 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "lint": "run-p --aggregate-output --continue-on-error lint:*", "start": "node index start", "test": "run-p --aggregate-output --continue-on-error lint:* test:*", - "test:mocha": "webpack --mode=development && cross-env NODE_ENV=test TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.yml", + "test:mocha": "webpack --mode=development && cross-env NODE_ENV=test TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.yml 'test/**/*.ts'", + "test:nospec": "webpack --mode=development && cross-env NODE_ENV=test TS_NODE_PROJECT='./test/tsconfig.json' mocha --config=test/.mocharc.yml", "watch": "webpack --watch" }, "keywords": [ diff --git a/test/.mocharc.yml b/test/.mocharc.yml index c6a989c7..4e0d5796 100644 --- a/test/.mocharc.yml +++ b/test/.mocharc.yml @@ -2,7 +2,6 @@ color: true check-leaks: true recursive: true reporter: dot -spec: "test/**/*.ts" ignore: "test/client/**" extension: ["ts", "js"] require: