Skip to content

Restore testing package #3556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ packages/auth @bojeil-google @avolkovi @samhorlbeck @scottcrossen @firebase/jss
packages/auth-types @bojeil-google @avolkovi @samhorlbeck @scottcrossen @firebase/jssdk-global-approvers

# Testing Code
packages/testing @avolkovi @samhorlbeck @scottcrossen @yuchenshi @firebase/jssdk-global-approvers
packages/rules-unit-testing @avolkovi @samhorlbeck @scottcrossen @yuchenshi @firebase/jssdk-global-approvers

# RxFire Code
Expand Down
1 change: 1 addition & 0 deletions packages/testing/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
31 changes: 31 additions & 0 deletions packages/testing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# @firebase/testing

## 0.20.9

### Patch Changes

- Updated dependencies [[`a87676b8`](https://github.com/firebase/firebase-js-sdk/commit/a87676b84b78ccc2f057a22eb947a5d13402949c)]:
- @firebase/[email protected]
- [email protected]

## 0.20.8

### Patch Changes

- Updated dependencies [[`02419ce8`](https://github.com/firebase/firebase-js-sdk/commit/02419ce8470141f012d9ce425a6a4a4aa912e480)]:
- [email protected]

## 0.20.7

### Patch Changes

- 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)]:
- [email protected]

## 0.20.6

### Patch Changes

- 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)]:
- [email protected]
- @firebase/[email protected]
9 changes: 9 additions & 0 deletions packages/testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @firebase/testing

A set of utilities useful for testing Security Rules with the Realtime Database or Cloud Firestore
emulators.

See:

* [Test your Cloud Firestore Security Rules](https://firebase.google.com/docs/firestore/security/test-rules-emulator)
* [Testing Security Rules with the Realtime Database Emulator](https://firebase.google.com/docs/database/security/test-rules-emulator)
13 changes: 13 additions & 0 deletions packages/testing/firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"emulators": {
"firestore": {
"port": 9001
},
"database": {
"port": 9000
},
"ui": {
"enabled": false
}
}
}
35 changes: 35 additions & 0 deletions packages/testing/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* The testing module does not need to be registered since it should not ever
* come by default. The only way to use the testing module is by explicitly
* creating a dependency on @firebase/testing.
*/

export {
apps,
assertFails,
assertSucceeds,
clearFirestoreData,
database,
firestore,
initializeAdminApp,
initializeTestApp,
loadDatabaseRules,
loadFirestoreRules
} from './src/api';
42 changes: 42 additions & 0 deletions packages/testing/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@firebase/testing",
"version": "0.20.9",
"description": "",
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
"main": "dist/index.cjs.js",
"engines": {
"node": "^8.13.0 || >=10.10.0"
},
"files": ["dist"],
"scripts": {
"build": "rollup -c",
"build:deps": "lerna run --scope @firebase/testing --include-dependencies build",
"dev": "rollup -c -w",
"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",
"test": "firebase emulators:exec 'yarn test:nyc'",
"test:ci": "node ../../scripts/run_tests_in_ci.js",
"prepare": "yarn build"
},
"license": "Apache-2.0",
"dependencies": {
"firebase": "7.17.1",
"@firebase/logger": "0.2.6",
"@firebase/util": "0.3.0",
"request": "2.88.2"
},
"devDependencies": {
"@types/request": "2.48.5",
"firebase-tools": "8.6.0",
"rollup": "2.23.0",
"rollup-plugin-typescript2": "0.27.1"
},
"repository": {
"directory": "packages/testing",
"type": "git",
"url": "https://github.com/firebase/firebase-js-sdk.git"
},
"typings": "dist/index.d.ts",
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
}
}
37 changes: 37 additions & 0 deletions packages/testing/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* @license
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import typescriptPlugin from 'rollup-plugin-typescript2';
import pkg from './package.json';
import typescript from 'typescript';

const plugins = [
typescriptPlugin({
typescript
})
];

const deps = Object.keys(
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
);

export default {
input: 'index.ts',
output: [{ file: pkg.main, format: 'cjs', sourcemap: true }],
plugins: [...plugins],
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
};
Loading