Skip to content

Commit c5b7268

Browse files
authored
Restore testing package (#3556)
1 parent f9d9898 commit c5b7268

File tree

11 files changed

+610
-0
lines changed

11 files changed

+610
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ packages/auth @bojeil-google @avolkovi @samhorlbeck @scottcrossen @firebase/jss
5959
packages/auth-types @bojeil-google @avolkovi @samhorlbeck @scottcrossen @firebase/jssdk-global-approvers
6060

6161
# Testing Code
62+
packages/testing @avolkovi @samhorlbeck @scottcrossen @yuchenshi @firebase/jssdk-global-approvers
6263
packages/rules-unit-testing @avolkovi @samhorlbeck @scottcrossen @yuchenshi @firebase/jssdk-global-approvers
6364

6465
# RxFire Code

packages/testing/.firebaserc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

packages/testing/CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# @firebase/testing
2+
3+
## 0.20.9
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`a87676b8`](https://github.com/firebase/firebase-js-sdk/commit/a87676b84b78ccc2f057a22eb947a5d13402949c)]:
8+
- @firebase/util@0.3.0
9+
10+
11+
## 0.20.8
12+
13+
### Patch Changes
14+
15+
- Updated dependencies [[`02419ce8`](https://github.com/firebase/firebase-js-sdk/commit/02419ce8470141f012d9ce425a6a4a4aa912e480)]:
16+
17+
18+
## 0.20.7
19+
20+
### Patch Changes
21+
22+
- Updated dependencies [[`9c409ea7`](https://github.com/firebase/firebase-js-sdk/commit/9c409ea74efd00fe17058c5c8b74450fae67e9ee), [`5a355360`](https://github.com/firebase/firebase-js-sdk/commit/5a3553609da893d45f7fe1897387f72eaedf2fe0), [`c2b737b2`](https://github.com/firebase/firebase-js-sdk/commit/c2b737b2187cb525af4d926ca477102db7835420), [`9a9a81fe`](https://github.com/firebase/firebase-js-sdk/commit/9a9a81fe4f001f23e9fe1db054c2e7159fca3ae3)]:
23+
24+
25+
## 0.20.6
26+
27+
### Patch Changes
28+
29+
- Updated dependencies [[`a754645e`](https://github.com/firebase/firebase-js-sdk/commit/a754645ec2be1b8c205f25f510196eee298b0d6e), [`17c628eb`](https://github.com/firebase/firebase-js-sdk/commit/17c628eb228c21ad1d4db83fdae08d1142a2b902), [`bb740836`](https://github.com/firebase/firebase-js-sdk/commit/bb7408361519aa9a58c8256ae01914cf2830e118), [`39ca8ecf`](https://github.com/firebase/firebase-js-sdk/commit/39ca8ecf940472159d0bc58212f34a70146da60c), [`877c060c`](https://github.com/firebase/firebase-js-sdk/commit/877c060c47bb29a8efbd2b96d35d3334fd9d9a98), [`e90304c8`](https://github.com/firebase/firebase-js-sdk/commit/e90304c8ac4341d8b23b55da784eb21348b04025), [`469c8bdf`](https://github.com/firebase/firebase-js-sdk/commit/469c8bdf18c4a22e99d595a9896af2f934df20fd)]:
30+
31+
- @firebase/logger@0.2.6

packages/testing/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# @firebase/testing
2+
3+
A set of utilities useful for testing Security Rules with the Realtime Database or Cloud Firestore
4+
emulators.
5+
6+
See:
7+
8+
* [Test your Cloud Firestore Security Rules](https://firebase.google.com/docs/firestore/security/test-rules-emulator)
9+
* [Testing Security Rules with the Realtime Database Emulator](https://firebase.google.com/docs/database/security/test-rules-emulator)

packages/testing/firebase.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"emulators": {
3+
"firestore": {
4+
"port": 9001
5+
},
6+
"database": {
7+
"port": 9000
8+
},
9+
"ui": {
10+
"enabled": false
11+
}
12+
}
13+
}

packages/testing/index.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @license
3+
* Copyright 2017 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+
/*
19+
* The testing module does not need to be registered since it should not ever
20+
* come by default. The only way to use the testing module is by explicitly
21+
* creating a dependency on @firebase/testing.
22+
*/
23+
24+
export {
25+
apps,
26+
assertFails,
27+
assertSucceeds,
28+
clearFirestoreData,
29+
database,
30+
firestore,
31+
initializeAdminApp,
32+
initializeTestApp,
33+
loadDatabaseRules,
34+
loadFirestoreRules
35+
} from './src/api';

packages/testing/package.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "@firebase/testing",
3+
"version": "0.20.9",
4+
"description": "",
5+
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
6+
"main": "dist/index.cjs.js",
7+
"engines": {
8+
"node": "^8.13.0 || >=10.10.0"
9+
},
10+
"files": ["dist"],
11+
"scripts": {
12+
"build": "rollup -c",
13+
"build:deps": "lerna run --scope @firebase/testing --include-dependencies build",
14+
"dev": "rollup -c -w",
15+
"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",
16+
"test": "firebase emulators:exec 'yarn test:nyc'",
17+
"test:ci": "node ../../scripts/run_tests_in_ci.js",
18+
"prepare": "yarn build"
19+
},
20+
"license": "Apache-2.0",
21+
"dependencies": {
22+
"firebase": "7.17.1",
23+
"@firebase/logger": "0.2.6",
24+
"@firebase/util": "0.3.0",
25+
"request": "2.88.2"
26+
},
27+
"devDependencies": {
28+
"@types/request": "2.48.5",
29+
"firebase-tools": "8.6.0",
30+
"rollup": "2.23.0",
31+
"rollup-plugin-typescript2": "0.27.1"
32+
},
33+
"repository": {
34+
"directory": "packages/testing",
35+
"type": "git",
36+
"url": "https://github.com/firebase/firebase-js-sdk.git"
37+
},
38+
"typings": "dist/index.d.ts",
39+
"bugs": {
40+
"url": "https://github.com/firebase/firebase-js-sdk/issues"
41+
}
42+
}

packages/testing/rollup.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* @license
3+
* Copyright 2018 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 typescriptPlugin from 'rollup-plugin-typescript2';
19+
import pkg from './package.json';
20+
import typescript from 'typescript';
21+
22+
const plugins = [
23+
typescriptPlugin({
24+
typescript
25+
})
26+
];
27+
28+
const deps = Object.keys(
29+
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
30+
);
31+
32+
export default {
33+
input: 'index.ts',
34+
output: [{ file: pkg.main, format: 'cjs', sourcemap: true }],
35+
plugins: [...plugins],
36+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
37+
};

0 commit comments

Comments
 (0)