@@ -85,6 +85,12 @@ information on using pull requests.
85
85
86
86
## <a name =" local-setup " ></a >Need to get set up locally?
87
87
88
+ ### Prerequisites
89
+
90
+ 1 . Node.js 8.13.0 or higher.
91
+ 2 . NPM 5 or higher (NPM 6 recommended).
92
+ 3 . Google Cloud SDK ([ ` gcloud ` ] ( https://cloud.google.com/sdk/downloads ) utility)
93
+
88
94
### Initial Setup
89
95
90
96
Run the following commands from the command line to get your local environment set up:
@@ -95,9 +101,8 @@ $ cd firebase-admin-node # go to the firebase-admin-node directory
95
101
$ npm install # install local npm build / test dependencies
96
102
```
97
103
98
- In order to run the tests, you also need to
99
- [ download the ` gcloud ` CLI] ( https://cloud.google.com/sdk/downloads ) , run the following command, and
100
- follow the prompts:
104
+ In order to run the tests, you also need to authorize the ` gcloud ` utility with
105
+ Google application default credentials:
101
106
102
107
``` bash
103
108
$ gcloud beta auth application-default login
@@ -130,19 +135,31 @@ If you wish to skip the linter, and only run the unit tests:
130
135
$ npm run test:unit
131
136
```
132
137
133
- The integration test suite requires a service account JSON key file, and an API key for a Firebase
134
- project. Create a new project in the [ Firebase console] ( https://console.firebase.google.com ) if
135
- you do not already have one. Use a separate, dedicated project for integration tests since the
136
- test suite makes a large number of writes to the Firebase realtime database. Download the service
137
- account key file from the "Settings > Service Accounts" page of the project, and copy it to
138
- ` test/resources/key.json ` . Also obtain the API key for the same project from "Settings > General",
139
- and save it to ` test/resources/apikey.txt ` .
140
-
141
- Some Auth integration tests require that you enable the IAM API for your Firebase/GCP project,
142
- and grant your service account ID the "Service Account Token Creator" role. These must be done
143
- via the Google Cloud Console. Refer to the
144
- [ troubleshooting instructions] ( https://firebase.google.com/docs/auth/admin/create-custom-tokens#troubleshooting )
145
- in the official documentation for more details on how to achieve this.
138
+ The integration tests run against an actual Firebase project. Create a new
139
+ project in the [ Firebase Console] ( https://console.firebase.google.com ) , if you
140
+ do not already have one suitable for running the tests against. Then obtain the
141
+ following credentials from the project:
142
+
143
+ 1 . * Service account certificate* : This can be downloaded as a JSON file from
144
+ the "Settings > Service Accounts" tab of the Firebase console. Copy the
145
+ file into the repo so it's available at ` test/resources/key.json ` .
146
+ 2 . * Web API key* : This is displayed in the "Settings > General" tab of the
147
+ console. Copy it and save to a new text file at ` test/resources/apikey.txt ` .
148
+
149
+ Then set up your Firebase/GCP project as follows:
150
+
151
+ 1 . Enable Firestore: Go to the Firebase Console, and select "Database" from
152
+ the "Develop" menu. Click on the "Create database" button. You may choose
153
+ to set up Firestore either in the locked mode or in the test mode.
154
+ 2 . Enable password auth: Select "Authentication" from the "Develop" menu in
155
+ Firebase Console. Select the "Sign-in method" tab, and enable the
156
+ "Email/Password" sign-in method.
157
+ 3 . Enable the IAM API: Go to the
158
+ [ Google Cloud Platform Console] ( https://console.cloud.google.com ) and make
159
+ sure your Firebase/GCP project is selected. Select "APIs & Services >
160
+ Dashboard" from the main menu, and click the "ENABLE APIS AND SERVICES"
161
+ button. Search for and enable the "Identity and Access Management (IAM)
162
+ API".
146
163
147
164
Finally, to run the integration test suite:
148
165
0 commit comments