Skip to content

Commit 22f98db

Browse files
committed
Use one config file for both browser and node test.
1 parent 43c20e8 commit 22f98db

File tree

12 files changed

+20
-22
lines changed

12 files changed

+20
-22
lines changed

config/karma.base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const config = {
102102

103103
client: {
104104
mocha: {
105-
opts: `${__dirname}/mocha.browser.opts`
105+
opts: `${__dirname}/mocha.opts`
106106
},
107107

108108
// Pass through --grep option to filter the tests that run.

config/mocha.browser.opts

Lines changed: 0 additions & 6 deletions
This file was deleted.

config/mocha.node.opts

Lines changed: 0 additions & 6 deletions
This file was deleted.

config/mocha.opts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# See:
2+
# - https://mochajs.org/#mochaopts for more information on the mocha config file.
3+
# - https://mochajs.org/#usage for more information on mocha flags.
4+
# - https://github.com/karma-runner/karma-mocha for more information on mocha flags supported by
5+
# the karma mocha runner.
6+
--timeout 20000
7+
--retries 5
8+
9+
# Node doesn't exit after mocha test completion. Supplying this flag for force exit.
10+
--exit

packages/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"test": "run-p test:browser test:node",
1717
"test:browser": "karma start --single-run",
1818
"test:browser:debug": "karma start --browsers Chrome --auto-watch",
19-
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha test/**/*.test.* --compilers ts:ts-node/register/type-check --opts ../../config/mocha.node.opts",
19+
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha test/**/*.test.* --compilers ts:ts-node/register/type-check --opts ../../config/mocha.opts",
2020
"prepare": "npm run build"
2121
},
2222
"license": "Apache-2.0",

packages/database/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dev": "rollup -c -w",
1515
"test": "run-p test:browser test:node",
1616
"test:browser": "karma start --single-run",
17-
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --compilers ts:ts-node/register/type-check -r src/nodePatches.ts --retries 5 --timeout 5000 --opts ../../config/mocha.node.opts",
17+
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --compilers ts:ts-node/register/type-check -r src/nodePatches.ts --opts ../../config/mocha.opts",
1818
"prepare": "npm run build"
1919
},
2020
"license": "Apache-2.0",

packages/firestore/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"test:all": "run-p test:browser test:node",
1414
"test:browser": "karma start --single-run",
1515
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",
16-
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register/type-check --require index.node.ts --retries 5 --timeout 5000 --opts ../../config/mocha.node.opts",
17-
"test:node:persistence": "USE_MOCK_PERSISTENCE=YES TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register/type-check --require index.node.ts --require test/util/node_persistence.ts --retries 5 --timeout 5000 --opts ../../config/mocha.node.opts",
16+
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register/type-check --require index.node.ts --opts ../../config/mocha.opts",
17+
"test:node:persistence": "USE_MOCK_PERSISTENCE=YES TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register/type-check --require index.node.ts --require test/util/node_persistence.ts --opts ../../config/mocha.opts",
1818
"prepare": "npm run build"
1919
},
2020
"main": "dist/index.node.cjs.js",

packages/functions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"test": "run-p test:browser test:node",
1616
"test:browser": "karma start --single-run",
1717
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",
18-
"test:node": "nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register --require index.node.ts --retries 5 --timeout 5000 --opts ../../config/mocha.node.opts",
18+
"test:node": "nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register --require index.node.ts --opts ../../config/mocha.opts",
1919
"test:emulator": "env FIREBASE_FUNCTIONS_EMULATOR_ORIGIN=http://localhost:5005 run-p test:node",
2020
"prepare": "npm run build"
2121
},

packages/logger/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"test": "run-p test:browser test:node",
1515
"test:browser": "karma start --single-run",
1616
"test:browser:debug": "karma start --browsers Chrome --auto-watch",
17-
"test:node": "nyc --reporter lcovonly -- mocha test/**/*.test.* --compilers ts:ts-node/register --opts ../../config/mocha.node.opts",
17+
"test:node": "nyc --reporter lcovonly -- mocha test/**/*.test.* --compilers ts:ts-node/register --opts ../../config/mocha.opts",
1818
"prepare": "npm run build"
1919
},
2020
"license": "Apache-2.0",

packages/template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dev": "rollup -c -w",
1616
"test": "run-p test:browser test:node",
1717
"test:browser": "karma start --single-run",
18-
"test:node": "nyc --reporter lcovonly -- mocha test/**/*.test.* --compilers ts:ts-node/register --opts ../../config/mocha.node.opts",
18+
"test:node": "nyc --reporter lcovonly -- mocha test/**/*.test.* --compilers ts:ts-node/register --opts ../../config/mocha.opts",
1919
"prepare": "npm run build"
2020
},
2121
"peerDependencies": {

packages/testing/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"scripts": {
1111
"build": "rollup -c",
1212
"dev": "rollup -c -w",
13-
"test": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register/type-check --retries 5 --timeout 5000 --opts ../../config/mocha.node.opts",
13+
"test": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register/type-check --retries 5 --timeout 5000 --opts ../../config/mocha.opts",
1414
"prepare": "npm run build"
1515
},
1616
"license": "Apache-2.0",

packages/util/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dev": "rollup -c -w",
1515
"test": "run-p test:browser test:node",
1616
"test:browser": "karma start --single-run",
17-
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha test/**/*.test.* --compilers ts:ts-node/register/type-check --opts ../../config/mocha.node.opts",
17+
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha test/**/*.test.* --compilers ts:ts-node/register/type-check --opts ../../config/mocha.opts",
1818
"prepare": "npm run build"
1919
},
2020
"license": "Apache-2.0",

0 commit comments

Comments
 (0)