Skip to content

Commit aedc176

Browse files
committed
Add launch task for debugging tests
1 parent 7e5318c commit aedc176

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

.vscode/launch.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [{
4+
"name": "Debug tests",
5+
"type": "node",
6+
"request": "launch",
7+
"protocol": "auto",
8+
"stopOnEntry": false,
9+
"console": "integratedTerminal",
10+
"args": [
11+
"node_modules/.bin/jest",
12+
"--no-cache",
13+
"--runInBand",
14+
"--env=node-debug",
15+
"--config=jest.config.json"
16+
],
17+
"skipFiles": [
18+
"<node_internals>/**/*.js",
19+
"${workspaceRoot}/node_modules/**/*.js"
20+
]
21+
}]
22+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"@types/jest": "^19.2.2",
4646
"dts-bundle": "^0.7.2",
4747
"jest": "^19.0.2",
48+
"jest-environment-node-debug": "^2.0.0",
4849
"pascal-case": "^2.0.0",
4950
"rimraf": "^2.6.1",
5051
"rollup": "^0.41.6",

src/__tests__/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
import { HelloWorld } from '..';
1+
import { HelloWorld, doSomethingAsync } from '..';
22
import * as utils from '../utils';
33

44
test('hello world', () => {
55
const thing = new HelloWorld('neat');
6-
76
expect(thing.getMessage()).toBe('Hello, this is neat');
87
});
98

109
test('utils', () => {
1110
expect(utils.add(1, 4)).toBe(5);
1211
});
12+
13+
test('async', async () => {
14+
const result = await doSomethingAsync();
15+
expect(result).toBe('hello');
16+
});

0 commit comments

Comments
 (0)