UNPKG

2.75 kBMarkdownView Raw
1# @firebase/auth
2
3This is the Firebase Authentication component of the Firebase JS SDK.
4
5**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**
6
7## Testing
8
9The modular Auth SDK has both unit tests and integration tests, along with a
10host of npm scripts to run these tests. The most important commands are:
11
12| Command | Description |
13| ------- | ----------- |
14| `yarn test` | This will run lint, unit tests, and integration tests against the live environment|
15| `yarn test:<platform>` | Runs all browser tests, unit and integration |
16| `yarn test:<platform>:unit` | Runs only \<platform> unit tests |
17| `yarn test:<platform>:unit:debug` | Runs \<platform> unit tests, auto-watching for file system changes |
18| `yarn test:<platform>:integration` | Runs only integration tests against the live environment |
19| `yarn test:<platform>:integration:local` | Runs all headless \<platform> integration tests against the emulator (more below) |
20
21Where \<platform> is "browser" or "node". There are also cordova tests, but they
22are not broken into such granular details. Check out `package.json` for more.
23
24### Integration testing with the emulator
25
26To test against the emulator, set up the Auth emulator
27([instructions](https://firebase.google.com/docs/emulator-suite/connect_and_prototype)).
28The easiest way to run these tests is to use the `firebase emulators:exec`
29command
30([documentation](https://firebase.google.com/docs/emulator-suite/install_and_configure#startup)).
31You can also manually start the emulator separately, and then point the tests
32to it by setting the `GCLOUD_PROJECT` and `FIREBASE_AUTH_EMULATOR_HOST`
33environmental variables. In addition to the commands listed above, the below
34commands also run various tests:
35
36 * `yarn test:integration:local` — Executes Node and browser emulator
37 integration tests, as well as the Selenium WebDriver tests
38
39 * `yarn test:webdriver` — Executes only the Selenium WebDriver
40 integration tests
41
42For example, to run all integration and WebDriver tests against the emulator,
43you would simply execute the following command:
44
45```sh
46firebase emulators:exec --project foo-bar --only auth "yarn test:integration:local"
47```
48
49### Selenium Webdriver tests
50
51These tests assume that you have both Firefox and Chrome installed on your
52computer and in your `$PATH`. The tests will error out if this is not the case.
53The WebDriver tests talk to the emulator, but unlike the headless integration
54tests, these run in a browser robot environment; the assertions themselves run
55in Node. When you run these tests a small Express server will be started to
56serve the static files the browser robot uses.