-
Notifications
You must be signed in to change notification settings - Fork 938
Migrate testing to rules-unit-testing #3378
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
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b336c8b
Migrate testing to rules-unit-testing
samtstern ff83ad6
Remove bad dep
samtstern 543fbb3
Merge branch 'master' into ss-fork-testing
samtstern 60381b3
Fix dev dependency
samtstern 318ecca
Fix how env is checked
samtstern 6b85198
var name
samtstern 98c993f
Merge remote-tracking branch 'origin/master' into ss-fork-testing
samtstern a7351d8
Deps
samtstern f4864f0
Update Firestore dep
samtstern d1ac304
Fix yarn.lock
samtstern ab2352b
Make tests pass
samtstern b431203
Merge remote-tracking branch 'origin/master' into ss-fork-testing
samtstern 8f54ed5
Add changeset
samtstern 3e2b499
Update versions and changeset
samtstern 2b92d40
Merge remote-tracking branch 'origin/master' into ss-fork-testing
samtstern f9d9898
Merge remote-tracking branch 'origin/master' into ss-fork-testing
samtstern c5b7268
Restore testing package (#3556)
samtstern d9bdde6
Update changeset ignore config
samtstern 9ee4bf9
Revert some changes
samtstern 23fc04a
Revert some changes
samtstern be695ee
No changelog
samtstern 186908f
Merge branch 'master' into ss-fork-testing
samtstern 9993f0d
Update package.json
samtstern cb12261
No port conflict
samtstern 3b0c125
Merge remote-tracking branch 'origin/master' into ss-fork-testing
samtstern File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@firebase/rules-unit-testing': major | ||
--- | ||
|
||
Release `@firebase/rules-unit-testing` to replace the `@firebase/testing` package. The new | ||
package is API compatible but has the following breaking behavior changes: | ||
|
||
* `assertFails()` will now only fail on `PERMISSION DENIED` errors, not any error. | ||
* `initializeAdminApp()` now relies on `firebase-admin` rather than imitating the Admin SDK. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# @firebase/testing | ||
|
||
## 0.20.10 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies []: | ||
- [email protected] | ||
|
||
## 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# @firebase/rules-unit-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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"emulators": { | ||
"firestore": { | ||
"port": 9001 | ||
}, | ||
"database": { | ||
"port": 9000 | ||
}, | ||
"ui": { | ||
"enabled": false | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/rules-unit-testing. | ||
*/ | ||
|
||
export { | ||
apps, | ||
assertFails, | ||
assertSucceeds, | ||
clearFirestoreData, | ||
database, | ||
firestore, | ||
initializeAdminApp, | ||
initializeTestApp, | ||
loadDatabaseRules, | ||
loadFirestoreRules | ||
} from './src/api'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "@firebase/rules-unit-testing", | ||
"version": "0.1.0", | ||
"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/rules-unit-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.2", | ||
"@firebase/logger": "0.2.6", | ||
"@firebase/util": "0.3.0", | ||
"request": "2.88.2" | ||
}, | ||
"devDependencies": { | ||
"@google-cloud/firestore": "4.2.0", | ||
"@types/request": "2.48.5", | ||
"firebase-admin": "9.0.0", | ||
"firebase-tools": "8.7.0", | ||
"rollup": "2.23.0", | ||
"rollup-plugin-typescript2": "0.27.1" | ||
}, | ||
"peerDependencies": { | ||
"@google-cloud/firestore": "^4.2.0", | ||
"firebase-admin": "^9.0.0" | ||
}, | ||
"repository": { | ||
"directory": "packages/rules-unit-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" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}/`)) | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.