Browse Source

workflow: support debug single jest test file in vscode (#360)

wangtao0101 6 years ago
parent
commit
11d0778f9c
2 changed files with 32 additions and 0 deletions
  1. 25 0
      .vscode/launch.json
  2. 7 0
      scripts/jest.js

+ 25 - 0
.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
+    }
+  ]
+}

+ 7 - 0
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)