From 11d0778f9c6e0002af17e1e8d985245f510dc1d1 Mon Sep 17 00:00:00 2001 From: wangtao0101 Date: Wed, 23 Oct 2019 23:20:06 +0800 Subject: [PATCH] workflow: support debug single jest test file in vscode (#360) --- .vscode/launch.json | 25 +++++++++++++++++++++++++ scripts/jest.js | 7 +++++++ 2 files changed, 32 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 scripts/jest.js diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..c4ffd0fc --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Jest", + "type": "node", + "request": "launch", + "program": "${workspaceFolder}/scripts/jest.js", + "stopOnEntry": false, + "args": ["${fileBasename}", "--runInBand", "--detectOpenHandles"], + "cwd": "${workspaceFolder}", + "preLaunchTask": null, + "runtimeExecutable": null, + "runtimeArgs": ["--nolazy"], + "env": { + "NODE_ENV": "development" + }, + "console": "integratedTerminal", + "sourceMaps": true + } + ] +} diff --git a/scripts/jest.js b/scripts/jest.js new file mode 100644 index 00000000..676c322e --- /dev/null +++ b/scripts/jest.js @@ -0,0 +1,7 @@ +/** + * This file is the entry for debug single test file in vscode + * + * Not using node_modules/.bin/jest due to cross platform issues, see + * https://github.com/microsoft/vscode-recipes/issues/107 + */ +require('jest').run(process.argv)