Visual Studio Code (launch with babel, mocha)
Visual Studio Code 是個不錯的編輯器,不過設定上,還是有很多需要手動的動作
特此記錄
launch.json 範例:
1 | { |
2 | "version": "0.2.0", |
3 | "configurations": [ |
4 | { |
5 | "name": "Run app", |
6 | "type": "node", |
7 | "request": "launch", |
8 | "runtimeExecutable": "${workspaceRoot}/node_modules/babel-cli/bin/babel-node.js", |
9 | "program": "${workspaceRoot}/src/index.js", |
10 | "stopOnEntry": false, |
11 | "args": [ |
12 | "--presets es2015,stage-0" |
13 | ], |
14 | "env": { |
15 | "NODE_ENV": "development" |
16 | } |
17 | }, |
18 | { |
19 | "name": "Run mocha", |
20 | "type": "node", |
21 | "program": "${workspaceRoot}/node_modules/mocha/bin/mocha", |
22 | "stopOnEntry": false, |
23 | "args": [ |
24 | "--compilers", |
25 | "js:babel-register", |
26 | "test/**/*.js" |
27 | ], |
28 | "cwd": "${workspaceRoot}", |
29 | "runtimeExecutable": null, |
30 | "env": { |
31 | "NODE_ENV": "production" |
32 | } |
33 | } |
34 | ] |
35 | } |