Skip to content

Commit 0cde5b7

Browse files
authored
test: migrate tests from mocha to jest (#181)
1 parent 79983de commit 0cde5b7

27 files changed

+12536
-9126
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ jobs:
3535
paths:
3636
- node_modules
3737
key: v1-dependencies-{{ checksum "package.json" }}
38+
- run: npm run lint
3839
- run: npm test
3940
- codecov/upload:
40-
file: .nyc_output/*.json
41+
file: coverage/*.json
4142
- *persist_to_workspace
4243
publish:
4344
executor: daneel

.vscode/launch.json

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,18 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4-
{
5-
"type": "node",
6-
"request": "launch",
7-
"name": "Mocha All",
8-
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
9-
"args": [
10-
"--timeout",
11-
"999999",
12-
"--colors",
13-
"${workspaceFolder}/test"
14-
],
15-
"console": "integratedTerminal",
16-
"internalConsoleOptions": "neverOpen"
17-
},
18-
{
19-
"type": "node",
20-
"request": "launch",
21-
"name": "Mocha Current File",
22-
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
23-
"args": [
24-
"--timeout",
25-
"999999",
26-
"--colors",
27-
"${file}"
28-
],
29-
"console": "integratedTerminal",
30-
"internalConsoleOptions": "neverOpen"
31-
}
32-
]
4+
{
5+
"name": "Debug Jest Tests",
6+
"type": "node",
7+
"request": "launch",
8+
"runtimeArgs": [
9+
"--inspect-brk",
10+
"${workspaceRoot}/node_modules/.bin/jest",
11+
"--runInBand"
12+
],
13+
"console": "integratedTerminal",
14+
"internalConsoleOptions": "neverOpen",
15+
"port": 9229
16+
}
17+
]
3318
}

jest.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
// Currently unable to set coverage reporter watermarks in jest. See https://github.com/facebook/jest/issues/9734
3+
//
4+
// For our previous nyc watermark config, see
5+
// https://github.com/SmartThingsCommunity/smartapp-sdk-nodejs/blob/79983de15646dd3be84d2b3e82d409f9bc632959/package.json#L72
6+
coverageReporters: ['json', 'text'],
7+
testEnvironment: 'node',
8+
testMatch: ['**/test/**/*.[jt]s?(x)']
9+
}

0 commit comments

Comments
 (0)