1 | # @firebase/auth
|
2 |
|
3 | This 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 |
|
9 | The modular Auth SDK has both unit tests and integration tests, along with a
|
10 | host 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 |
|
21 | Where \<platform> is "browser" or "node". There are also cordova tests, but they
|
22 | are not broken into such granular details. Check out `package.json` for more.
|
23 |
|
24 | ### Integration testing with the emulator
|
25 |
|
26 | To test against the emulator, set up the Auth emulator
|
27 | ([instructions](https://firebase.google.com/docs/emulator-suite/connect_and_prototype)).
|
28 | The easiest way to run these tests is to use the `firebase emulators:exec`
|
29 | command
|
30 | ([documentation](https://firebase.google.com/docs/emulator-suite/install_and_configure#startup)).
|
31 | You can also manually start the emulator separately, and then point the tests
|
32 | to it by setting the `GCLOUD_PROJECT` and `FIREBASE_AUTH_EMULATOR_HOST`
|
33 | environmental variables. In addition to the commands listed above, the below
|
34 | commands 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 |
|
42 | For example, to run all integration and WebDriver tests against the emulator,
|
43 | you would simply execute the following command:
|
44 |
|
45 | ```sh
|
46 | firebase emulators:exec --project foo-bar --only auth "yarn test:integration:local"
|
47 | ```
|
48 |
|
49 | ### Selenium Webdriver tests
|
50 |
|
51 | These tests assume that you have both Firefox and Chrome installed on your
|
52 | computer and in your `$PATH`. The tests will error out if this is not the case.
|
53 | The WebDriver tests talk to the emulator, but unlike the headless integration
|
54 | tests, these run in a browser robot environment; the assertions themselves run
|
55 | in Node. When you run these tests a small Express server will be started to
|
56 | serve the static files the browser robot uses.
|