Skip to content

Commit 740bff7

Browse files
committed
chore: setup jest for monorepo watch, vscode for debugging
1 parent 5b8459c commit 740bff7

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

.vscode/launch.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Jest Current File",
9+
"type": "node",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/node_modules/.bin/jest",
12+
"args": ["${fileBasenameNoExtension}", "--config", "jest.config.js"],
13+
"console": "integratedTerminal",
14+
"internalConsoleOptions": "neverOpen",
15+
"runtimeArgs": ["--nolazy"], // tells v8 to compile your code ahead of time, so that breakpoints work correctly
16+
"disableOptimisticBPs": true // also helps that breakpoints work correctly
17+
},
18+
{
19+
"name": "Jest",
20+
"type": "node",
21+
"request": "launch",
22+
"program": "${workspaceFolder}/node_modules/.bin/jest",
23+
"args": ["--runInBand", "--watch"],
24+
"cwd": "${workspaceFolder}",
25+
"console": "integratedTerminal",
26+
"internalConsoleOptions": "neverOpen",
27+
"disableOptimisticBPs": true
28+
}
29+
]
30+
}

.vscode/tasks.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Eslint checks",
8+
"type": "shell",
9+
"command": "./node_modules/.bin/eslint 'packages/*/src/**/*.{js,ts,tsx}'",
10+
"problemMatcher": ["$eslint-stylish"],
11+
"isBackground": true,
12+
"presentation": {
13+
"reveal": "never"
14+
},
15+
"runOptions": {
16+
"reevaluateOnRerun": true,
17+
"runOn": "folderOpen"
18+
},
19+
"group": {
20+
"kind": "build",
21+
"isDefault": true
22+
}
23+
}
24+
]
25+
}

jest.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
globals: {
4+
'ts-jest': {
5+
tsConfig: '<rootDir>/tsconfig.test.json',
6+
isolatedModules: true,
7+
diagnostics: false,
8+
},
9+
},
10+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
11+
transform: {
12+
'^.+\\.ts$': 'ts-jest',
13+
},
14+
roots: ['<rootDir>/src'],
15+
testPathIgnorePatterns: ['/node_modules/', '/lib/'],
16+
testMatch: ['**/__tests__/**/*-test.(ts|js)'],
17+
projects: ['packages/*'],
18+
};

0 commit comments

Comments
 (0)