Skip to content

Commit 03f438e

Browse files
committed
Added instructions for running the tests. Fixes #49.
1 parent 2568fc2 commit 03f438e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,51 @@ Contributions welcome!
6060

6161
See [CONTRIBUTING.md](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md)
6262

63+
### Running the tests
64+
65+
1. `git clone [email protected]:GoogleCloudPlatform/nodejs-docs-samples.git`
66+
1. `cd nodejs-docs-samples`
67+
1. `npm install`
68+
1. Start Redis
69+
1. Start Memcached
70+
1. Set the `TEST_PROJECT_ID` environment variable to id of your project
71+
1. `npm test`
72+
73+
Since the tests use [Mocha.js](https://mochajs.org/), you can use the `--grep`
74+
option to run only the tests that match a provided pattern. The `--invert`
75+
option causes the matched tests to be excluded instead of included.
76+
77+
__Run only the tests that match a pattern:__
78+
79+
80+
```
81+
npm test -- -- --grep <pattern>
82+
```
83+
84+
__Only run the tests for the `datastore` sample:__
85+
86+
```
87+
npm test -- -- --grep datastore
88+
```
89+
90+
__Skip the tests that match a pattern:__
91+
92+
```
93+
npm test -- -- --grep <pattern> --invert
94+
```
95+
96+
__Run all but the `datastore` tests:__
97+
98+
```
99+
npm test -- -- --grep datastore --invert
100+
```
101+
102+
__Skip the tests that require Redis and Memcached:__
103+
104+
```
105+
npm test -- -- --grep "express-memcached-session|redis" --invert
106+
```
107+
63108
## Licensing
64109

65110
Apache Version 2.0

0 commit comments

Comments
 (0)