Skip to content

Commit b275a62

Browse files
authored
Use a single npm target to run unit tests (GoogleChrome#1430)
* Combine test steps into one npm script. * Update README * Return the test run exit status as the overall exit status
1 parent 849a853 commit b275a62

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,10 @@ npm run lint
5454
To run unit tests:
5555

5656
```bash
57-
npm run start-emulator # Start the emulator
58-
npm run test # Reset the datastore emulator and start testing
59-
npm run stop-emulator # Stop the emulator. You do not have to stop the emulator between consecutive tests
57+
npm test
6058
```
6159

62-
Note: featurelist is temporarily excluded because lit-analyzer throws `Maximum call stack size exceeded`.
60+
This will start a local datastore emulator, run unit tests, and then shut down the emulator.
6361

6462
There are some developing information in developer-documentation.md.
6563

@@ -70,7 +68,6 @@ There are some developing information in developer-documentation.md.
7068

7169
- When installing the GAE SDK, make sure to get the version for python 2.7. It is no longer the default version.
7270

73-
- When running `npm start` you may get an ImportError for jinja2.tests. This was caused by an over-general line in skip_files.yaml. Pulling the latest source code should resolve the problem.
7471

7572
#### Blink components
7673

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
"deps": "python -m pip install -t lib -r requirements.txt --upgrade",
1111
"travis-deps": "pip install -t lib -r requirements.travis.txt --upgrade",
1212
"dev-deps": "python -m pip install --no-deps -r requirements.dev.txt",
13-
"test": "curl -X POST 'http://localhost:15606/reset' && python -m unittest discover -p '*_test.py' -b",
13+
"do-tests": "curl -X POST 'http://localhost:15606/reset' && python -m unittest discover -p '*_test.py' -b",
1414
"start-emulator" : "gcloud beta emulators datastore start --host-port=:15606 --no-store-on-disk --consistency=1.0",
1515
"stop-emulator" : "curl -X POST 'http://localhost:15606/shutdown'",
16+
"test": "(npm run start-emulator > /dev/null 2>&1 &); sleep 3; curl --retry 4 http://localhost:15606/ --retry-connrefused; npm run do-tests; status=$?; npm run stop-emulator; exit $status",
1617
"coverage": "python -m pip install --no-deps -r requirements.dev.txt && python -m coverage erase && python -m coverage run -m unittest discover -p '*_test.py' -b && python -m coverage html",
1718
"lint": "gulp lint-fix && lit-analyzer \"static/elements/chromedash-!(featurelist)*.js\"",
1819
"build": "gulp",

0 commit comments

Comments
 (0)