Skip to content

Commit fe3de50

Browse files
Ability to specify tests to run (#55)
* Ability to specify tests to run Signed-off-by: Levko Kravets <levko.ne@gmail.com>
1 parent 37c8035 commit fe3de50

File tree

5 files changed

+29
-21
lines changed

5 files changed

+29
-21
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ npm run build
9393
Run the tests
9494

9595
```bash
96-
npm run test
96+
npm test
9797
npm run e2e
9898
```
9999

@@ -104,6 +104,7 @@ npm run prettier
104104
npm run prettier:fix
105105
npm run lint
106106
npm run lint:fix
107+
npm run type-check
107108
```
108109

109110
## Pull Request Process

README.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,29 +61,16 @@ client
6161

6262
### Unit tests
6363

64-
```bash
65-
npm run test
66-
```
67-
68-
You can specify a specific test to run by changing `package.json`:
64+
You can run all unit tests, or specify a specific test to run:
6965

70-
```json
71-
"scripts": {
72-
"test": "nyc --reporter=lcov mocha 'tests/unit/result/JsonResult.test.js'",
73-
}
74-
```
75-
76-
Or to run all unit tests:
77-
78-
```json
79-
"scripts": {
80-
"test": "nyc --reporter=lcov mocha 'tests/unit/**/*.test.js'",
81-
}
66+
```bash
67+
npm test
68+
npm test <path/to/file.test.js>
8269
```
8370

8471
### e2e tests
8572

86-
Before running end-to-end tests, copy the [sample configuration file](tests/e2e/utils/config.js) into the repository root and set the Databricks SQL connection info:
73+
Before running end-to-end tests, create a file named `tests/e2e/utils/config.local.js` and set the Databricks SQL connection info:
8774

8875
```javascript
8976
{
@@ -98,6 +85,7 @@ Then run
9885

9986
```bash
10087
npm run e2e
88+
npm run e2e <path/to/file.test.js>
10189
```
10290

10391
## Contributing

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
},
1414
"scripts": {
1515
"prepare": "npm run build",
16-
"e2e": "nyc --reporter=lcov --report-dir=coverage_e2e mocha 'tests/e2e/**/*.test.js' --timeout=300000",
17-
"test": "nyc --reporter=lcov --report-dir=coverage_unit mocha 'tests/unit/**/*.test.js'",
16+
"e2e": "nyc --reporter=lcov --report-dir=coverage_e2e mocha --config tests/e2e/.mocharc.js",
17+
"test": "nyc --reporter=lcov --report-dir=coverage_unit mocha --config tests/unit/.mocharc.js",
1818
"build": "tsc",
1919
"watch": "tsc -w",
2020
"type-check": "tsc --noEmit",

tests/e2e/.mocharc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
const allSpecs = 'tests/e2e/**/*.test.js';
4+
5+
const argvSpecs = process.argv.slice(4);
6+
7+
module.exports = {
8+
spec: argvSpecs.length > 0 ? argvSpecs : allSpecs,
9+
timeout: '300000',
10+
};

tests/unit/.mocharc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
const allSpecs = 'tests/unit/**/*.test.js';
4+
5+
const argvSpecs = process.argv.slice(4);
6+
7+
module.exports = {
8+
spec: argvSpecs.length > 0 ? argvSpecs : allSpecs,
9+
};

0 commit comments

Comments
 (0)