npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ap0nia/firebase-auth

v1.8.0

Published

The Firebase Authenticaton component of the Firebase JS SDK.

Downloads

9

Readme

@firebase/auth

This is the Firebase Authentication component of the Firebase JS SDK.

This package is not intended for direct usage, and should only be used via the officially supported firebase package.

Testing

The modular Auth SDK has both unit tests and integration tests, along with a host of npm scripts to run these tests. The most important commands are:

| Command | Description | | ------- | ----------- | | yarn test | This will run lint, unit tests, and integration tests against the live environment| | yarn test:<platform> | Runs all browser tests, unit and integration | | yarn test:<platform>:unit | Runs only <platform> unit tests | | yarn test:<platform>:unit:debug | Runs <platform> unit tests, auto-watching for file system changes | | yarn test:<platform>:integration | Runs only integration tests against the live environment | | yarn test:<platform>:integration:local | Runs all headless <platform> integration tests against the emulator (more below) | | yarn test:browser:integration:prodbackend | Runs TOTP MFA integration tests against the backend (more below) |

Where <platform> is "browser" or "node". There are also cordova tests, but they are not broken into such granular details. Check out package.json for more.

Integration testing with the emulator

To test against the emulator, set up the Auth emulator (instructions). The easiest way to run these tests is to use the firebase emulators:exec command (documentation). You can also manually start the emulator separately, and then point the tests to it by setting the GCLOUD_PROJECT and FIREBASE_AUTH_EMULATOR_HOST environmental variables. In addition to the commands listed above, the below commands also run various tests:

  • yarn test:integration:local — Executes Node and browser emulator integration tests, as well as the Selenium WebDriver tests

  • yarn test:webdriver — Executes only the Selenium WebDriver integration tests

Note - The webdriver tests require the Chrome webdriver to match the version of Chrome running locally. In the CI environment, this is ensured using the environment variable here. When running locally, change the chromedriver version in package.json to match your local Chrome version and run yarn install.

For example, to run all integration and WebDriver tests against the emulator, you would simply execute the following command:

firebase emulators:exec --project foo-bar --only auth "yarn test:integration:local"

Integration testing with the production backend

Currently, MFA TOTP and password policy tests only run against the production backend (since they are not supported on the emulator yet). Running against the backend also makes it a more reliable end-to-end test.

The TOTP tests require the following email/password combination to exist in the project, so if you are running this test against your test project, please create this user:

'[email protected]', 'password'

You also need to verify this email address, in order to use MFA. This can be done with a curl command like this:

curl   -H "Authorization: Bearer $(gcloud auth print-access-token)"   -H "Content-Type: application/json"   -H "X-Goog-User-Project: ${PROJECT_ID}"   -X POST https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode   -d     '{
      "email": "[email protected]",
      "requestType": "VERIFY_EMAIL",
      "returnOobLink": true,
    }'

The password policy tests require a tenant configured with a password policy that requires all options to exist in the project.

If you are running this test against your test project, please create the tenant and configure the policy with the following curl command:

curl   -H "Authorization: Bearer $(gcloud auth print-access-token)"   -H "Content-Type: application/json"   -H "X-Goog-User-Project: ${PROJECT_ID}"   -X POST https://identitytoolkit.googleapis.com/v2/projects/${PROJECT_ID}/tenants   -d     '{
      "displayName": "passpol-tenant",
      "passwordPolicyConfig": {
        "passwordPolicyEnforcementState": "ENFORCE",
        "passwordPolicyVersions": [
          {
            "customStrengthOptions": {
              "minPasswordLength": 8,
              "maxPasswordLength": 24,
              "containsLowercaseCharacter": true,
              "containsUppercaseCharacter": true,
              "containsNumericCharacter": true,
              "containsNonAlphanumericCharacter": true
            }
          }
        ]
      }
    }'

Replace the tenant ID passpol-tenant-d7hha in test/integration/flows/password_policy.test.ts with the ID for the newly created tenant. The tenant ID can be found at the end of the name property in the response and is in the format passpol-tenant-xxxxx.

Selenium Webdriver tests

These tests assume that you have both Firefox and Chrome installed on your computer and in your $PATH. The tests will error out if this is not the case. The WebDriver tests talk to the emulator, but unlike the headless integration tests, these run in a browser robot environment; the assertions themselves run in Node. When you run these tests a small Express server will be started to serve the static files the browser robot uses.