Skip to content

Commit

Permalink
Run legacy tests last to avoid global pollution
Browse files Browse the repository at this point in the history
  • Loading branch information
sammacbeth committed Jul 5, 2023
1 parent 542a691 commit 3f79436
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ watch:
.PHONY: watch

## unit-test: Run the unit tests.
ESBUILD_TESTS = unit-test/shared-utils/*.js unit-test/ui/**/*.js unit-test/background/*.js unit-test/background/**/*.js
ESBUILD_TESTS = unit-test/background/*.js unit-test/background/**/*.js unit-test/ui/**/*.js unit-test/shared-utils/*.js
unit-test: build/test/legacy-background.js
$(ESBUILD) --outdir=build/test --inject:./unit-test/inject-chrome-shim.js $(ESBUILD_TESTS)
node_modules/.bin/karma start karma.conf.js
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function (config) {
basePath: 'build/test/',
frameworks: ['jasmine', 'source-map-support'],
singleRun: true,
files: ['*.js', '**/*.js'],
files: ['background/*.js', 'background/**/*.js', 'shared-utils/*.js', 'ui/**/*.js', 'legacy-background.js'],
logLevel: config.LOG_ERROR,
browserConsoleLogOptions: {
level: 'warn'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"eslint": "eslint '*.js' shared/js shared/data unit-test integration-test scripts",
"eslint-fix": "npm run eslint -- --fix",
"lint": "npm run eslint && npm run tsc",
"test": "make unit-test",
"test": "make -j2 unit-test",
"playwright": "make dev browser=chrome type=dev && playwright test",
"playwright-mv3": "make dev browser=chrome-mv3 type=dev && PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS=1 playwright test",
"tsc": "tsc",
Expand Down
5 changes: 4 additions & 1 deletion unit-test/inject-chrome-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ const chrome = {
updateSessionRules () { }
}
}
export { chrome as 'globalThis.chrome', chrome }
export {
chrome as 'globalThis.chrome',
chrome
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let parseQueryString = require('../../../../shared/js/ui/pages/mixins/parse-query-string')
let parseQueryString = require('../../../shared/js/ui/pages/mixins/parse-query-string')
parseQueryString = parseQueryString.parseQueryString

const tests = [
Expand Down

0 comments on commit 3f79436

Please sign in to comment.