From 1c573ef852e20789d3e2ff1233348a18c854fa4c Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 17 Mar 2021 10:50:59 -0230 Subject: [PATCH] Improve specificity of `test:unit:lax` npm script (#10661) The unit test npm script `test:unit:lax` is now more specific about which tests files to exclude. An `--ignore` CLI option is used to specify the files to ignore, rather than using the braces glob syntax to ignore them from the target glob itself. This makes the option easier to update going forward as we move more tests into the "strict" group, because the options are exactly the same between the two scripts. It also ensures we don't accidentally exclude other subdirectories that happen to also be named `permissions`. In trying to implement this, I stumbled at first because mocha expects the ignore pattern to be a relative path if the target is a relative path (i.e. they need to both start with `./` or neither). The script `test:unit:strict` has been updated to use a relative target pattern for consistency. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3fa468bce..0a84353a0 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "sendwithprivatedapp": "node development/static-server.js test/e2e/send-eth-with-private-key-test --port 8080", "test:unit": "mocha --exit --require test/env.js --require test/setup.js --recursive './{ui,app,shared}/**/*.test.js'", "test:unit:global": "mocha --exit --require test/env.js --require test/setup.js --recursive test/unit-global/*.test.js", - "test:unit:lax": "mocha --exit --require test/env.js --require test/setup.js --recursive './{ui,app,shared}/{,**/!(permissions)}/*.test.js'", - "test:unit:strict": "mocha --exit --require test/env.js --require test/setup.js --recursive 'app/scripts/controllers/permissions/*.test.js'", + "test:unit:lax": "mocha --exit --require test/env.js --require test/setup.js --ignore './app/scripts/controllers/permissions/*.test.js' --recursive './{ui,app,shared}/**/*.test.js'", + "test:unit:strict": "mocha --exit --require test/env.js --require test/setup.js --recursive './app/scripts/controllers/permissions/*.test.js'", "test:unit:path": "mocha --exit --require test/env.js --require test/setup.js --recursive", "test:e2e:chrome": "SELENIUM_BROWSER=chrome test/e2e/run-all.sh", "test:e2e:chrome:metrics": "SELENIUM_BROWSER=chrome mocha test/e2e/metrics.spec.js",