From 889310726eed808a84a4a22c94b897516e1b2195 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Mon, 31 Jul 2023 08:54:19 +0100 Subject: [PATCH] fix(tests): Make .mocharc.js CWD-independent (#7329) Move tests/browser/test/.mocharc.js to tests/browser and use __dirname to make the require directive work regardless of where mocha is invoked from. Simplify the browser:test script accordingly, taking advantage also of the mocha default of running all tests in the test/ subdirectory. --- package.json | 2 +- tests/browser/{test => }/.mocharc.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/browser/{test => }/.mocharc.js (54%) diff --git a/package.json b/package.json index 43e16ff1e..4c0b7df5e 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "start": "npm run build && concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir 'build/src' --declarationDir 'build/declarations'\" \"http-server ./ -s -o /tests/playground.html -c-1\"", "tsc": "gulp tsc", "test": "gulp test", - "test:browser": "npx mocha ./tests/browser/test --config ./tests/browser/test/.mocharc.js", + "test:browser": "cd tests/browser && npx mocha", "test:generators": "gulp testGenerators", "test:mocha:interactive": "http-server ./ -o /tests/mocha/index.html -c-1", "test:compile:advanced": "gulp buildAdvancedCompilationTest --debug", diff --git a/tests/browser/test/.mocharc.js b/tests/browser/.mocharc.js similarity index 54% rename from tests/browser/test/.mocharc.js rename to tests/browser/.mocharc.js index 58d3bf55e..b11a846fb 100644 --- a/tests/browser/test/.mocharc.js +++ b/tests/browser/.mocharc.js @@ -2,5 +2,5 @@ module.exports = { ui: 'tdd', - require: 'tests/browser/test/hooks.js', + require: __dirname + '/test/hooks.js', };