Skip to content

Commit 6984910

Browse files
committed
Fix firestore emulator issue
Emulator would keep running in bg even after test are done. This change fixes that so emulator is stopped after tests.
1 parent c52b690 commit 6984910

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

scripts/tests/testIntegration.sh

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,5 @@
33
# set 'test' environment
44
export NODE_ENV='test'
55

6-
# Set environment variable for firestore emulator host
7-
# @todo: Get port value from '../../firebase.json'
8-
export FIRESTORE_EMULATOR_HOST='localhost:8080'
9-
10-
echo 'Start Firestore Emulator:'
11-
firebase emulators:start &
12-
13-
echo 'Running integration tests:'
14-
nyc mocha test/integration/**
15-
16-
# Erase the database
17-
# @todo: Get port value from '../../firebase.json' and projectId from config
18-
# Route; DELETE http://localhost:<PORT>/emulator/v1/projects/<PROJECT_ID>/databases/(default)/documents
19-
echo 'Erasing Firestore data:'
20-
curl -v -X DELETE 'http://localhost:8080/emulator/v1/projects/rds-dev/databases/(default)/documents'
6+
echo 'Start firestore emulator and run integration tests:'
7+
firebase emulators:exec 'nyc mocha test/integration/**'

scripts/tests/testUnit.sh

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,5 @@
33
# set 'test' environment
44
export NODE_ENV='test'
55

6-
# set environment variable for firestore emulator host
7-
# @todo: Get port value from '../../firebase.json'
8-
export FIRESTORE_EMULATOR_HOST='localhost:8080'
9-
10-
echo 'Start Firestore Emulator:'
11-
firebase emulators:start &
12-
13-
echo 'Running unit tests:'
14-
nyc mocha test/unit/**
15-
16-
# Erase the database
17-
# @todo: Get port value from '../../firebase.json' and projectId from config
18-
# Route; DELETE http://localhost:<PORT>/emulator/v1/projects/<PROJECT_ID>/databases/(default)/documents
19-
echo 'Erasing Firestore data:'
20-
curl -v -X DELETE 'http://localhost:8080/emulator/v1/projects/rds-dev/databases/(default)/documents'
6+
echo 'Start firestore emulator and run unit tests:'
7+
firebase emulators:exec 'nyc mocha test/unit/**'

0 commit comments

Comments
 (0)