Skip to content
Permalink
Browse files

feat(starter): windows implementation of the vscode debug command

  • Loading branch information
MarshallOfSound authored and malept committed Apr 16, 2017
1 parent 1238dee commit 9cb7f42cf82f6a05030a620b5a93451c4c0a2c4e
Showing with 39 additions and 4 deletions.
  1. +3 −2 README.md
  2. +2 −1 package.json
  3. +9 −0 script/vscode.cmd
  4. +1 −1 src/electron-forge-start.js
  5. +24 −0 test/fast/start_spec.js
@@ -235,7 +235,7 @@ Debugging your Electron main process through VS Code is ridiculously
easy with Forge. Simply add this as a launch config in VSCode and you're
good to go.

```json
```js
{
"type": "node",
"request": "launch",
@@ -248,6 +248,7 @@ good to go.
"runtimeArgs": [
"foo",
"bar"
]
],
"cwd": "${workspaceRoot}"
}
```
@@ -7,7 +7,8 @@
"bin": {
"electron-forge": "dist/electron-forge.js",
"forge": "dist/electron-forge.js",
"electron-forge-vscode-nix": "script/vscode.sh"
"electron-forge-vscode-nix": "script/vscode.sh",
"electron-forge-vscode-win": "script/vscode.cmd"
},
"scripts": {
"build": "gulp build",
@@ -0,0 +1,9 @@
@echo off

SETLOCAL
SET FORGE_ARGS=%*

SET FORGE_ARGS=%FORGE_ARGS: =~ ~%
node "%~dp0/../../electron-forge/dist/electron-forge-start.js" --vscode --- ~%FORGE_ARGS%~

ENDLOCAL
@@ -49,8 +49,8 @@ import { start } from './api';
};

if (program.vscode && appArgs) {
// Args are in the format ~arg~ so we need to strip the "~"
appArgs = appArgs
// Args are in the format ~arg~ so we need to strip the "~"
.map(arg => arg.substr(1, arg.length - 2))
.filter(arg => arg.length > 0);
}
@@ -122,4 +122,28 @@ describe('start', () => {
enableLogging: true,
})).to.eventually.equal('child');
});

describe('cli', () => {
let argv;
beforeEach(() => {
argv = process.argv;
});

it('should remove all "~" from args when in VSCode debug mode', (done) => {
process.argv = ['--vscode', '---', '--foo', 'bar', 'this arg exists'];
proxyquire.noCallThru().load('../../src/electron-forge-start', {
'./api': {
start: (startOptions) => {
expect(startOptions.args).to.deep.equal(['--foo', 'bar', 'this arg exists']);
done();
return Promise.resolve();
},
},
});
});

afterEach(() => {
process.argv = argv;
});
});
});

0 comments on commit 9cb7f42

Please sign in to comment.
You can’t perform that action at this time.