Skip to content

Commit ad98719

Browse files
committed
Fix tests.
1 parent 5d4dba7 commit ad98719

File tree

4 files changed

+384
-12
lines changed

4 files changed

+384
-12
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @license
3+
* Copyright 2021 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
const base = require('../../config/mocharc.node.js');
19+
20+
module.exports = {
21+
...base,
22+
require: [base.require, 'test/setup.ts']
23+
};

packages/rules-unit-testing/package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
"build": "rollup -c",
1515
"build:deps": "lerna run --scope @firebase/rules-unit-testing --include-dependencies build",
1616
"dev": "rollup -c -w",
17-
"test:nyc": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --config ../../config/mocharc.node.js",
18-
"test": "FIREBASE_CLI_PREVIEWS=storageemulator STORAGE_EMULATOR_HOST=http://localhost:9199 firebase --project=foo --debug emulators:exec 'yarn test:nyc'",
17+
"test:nyc": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --config ./mocharc.node.js",
18+
"test": "firebase --project=demo-foo --debug emulators:exec 'yarn test:nyc'",
1919
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test"
2020
},
2121
"license": "Apache-2.0",
2222
"devDependencies": {
23+
"firebase-admin": "9.11.1",
24+
"firebase-functions": "3.15.4",
2325
"rollup": "2.52.2",
2426
"rollup-plugin-typescript2": "0.30.0"
2527
},
@@ -34,5 +36,8 @@
3436
"typings": "dist/index.d.ts",
3537
"bugs": {
3638
"url": "https://github.com/firebase/firebase-js-sdk/issues"
39+
},
40+
"dependencies": {
41+
"node-fetch": "2.6.1"
3742
}
3843
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* @license
3+
* Copyright 2019 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { use } from 'chai';
19+
import * as chaiAsPromised from 'chai-as-promised';
20+
import { restore } from 'sinon';
21+
import * as sinonChai from 'sinon-chai';
22+
23+
use(chaiAsPromised);
24+
use(sinonChai);
25+
26+
export const mochaHooks = {
27+
afterEach() {
28+
restore();
29+
}
30+
};

0 commit comments

Comments
 (0)