Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(cli): add --inspect-brk-electron option
  • Loading branch information
MOZGIII committed Mar 7, 2020
commit d84bcd92ce453b45186544eba38a7805280ec294
2 changes: 2 additions & 0 deletions 2 packages/api/cli/src/electron-forge-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import workingDir from './util/working-dir';
.option('-n, --run-as-node', 'Run the Electron app as a Node.JS script')
.option('--vscode', 'Used to enable arg transformation for debugging Electron through VSCode. Do not use yourself.')
.option('-i, --inspect-electron', 'Triggers inspect mode on Electron to allow debugging the main process. Electron >1.7 only')
.option('--inspect-brk-electron', 'Triggers inspect-brk mode on Electron to allow debugging the main process. Electron >1.7 only')
.action((cwd) => { dir = workingDir(dir, cwd); })
.parse(commandArgs);

Expand All @@ -44,6 +45,7 @@ import workingDir from './util/working-dir';
enableLogging: !!program.enableLogging,
runAsNode: !!program.runAsNode,
inspect: !!program.inspectElectron,
inspectBrk: !!program.inspectBrkElectron,
};

if (program.vscode && appArgs) {
Expand Down
5 changes: 5 additions & 0 deletions 5 packages/api/core/src/api/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default async ({
args = [],
runAsNode = false,
inspect = false,
inspectBrk = false,
}: StartOptions) => {
asyncOra.interactive = interactive;

Expand Down Expand Up @@ -65,6 +66,7 @@ export default async ({
args,
runAsNode,
inspect,
inspectBrk,
});
let prefixArgs: string[] = [];
if (typeof spawnedPluginChild === 'string') {
Expand Down Expand Up @@ -102,6 +104,9 @@ export default async ({
if (inspect) {
args = ['--inspect' as (string|number)].concat(args);
}
if (inspectBrk) {
args = ['--inspect-brk' as (string|number)].concat(args);
}

let spawned!: ElectronProcess;

Expand Down
15 changes: 15 additions & 0 deletions 15 packages/api/core/test/fast/start_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ describe('start', () => {
expect(spawnStub.firstCall.args[1].slice(1)).to.deep.equal(['--inspect'].concat(args));
});

it('should pass --inspect-brk at the start of the args if inspectBrk is set', async () => {
const args = ['magic'];
resolveStub.returnsArg(0);
spawnStub.returns(0);
await start({
args,
dir: __dirname,
interactive: false,
inspectBrk: true,
});
expect(spawnStub.callCount).to.equal(1);
expect(spawnStub.firstCall.args[0]).to.equal('fake_electron_path');
expect(spawnStub.firstCall.args[1].slice(1)).to.deep.equal(['--inspect-brk'].concat(args));
});

it('should resolve with a handle to the spawned instance', async () => {
resolveStub.returnsArg(0);
const fakeChild = { on: () => {} };
Expand Down
5 changes: 5 additions & 0 deletions 5 packages/utils/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export interface StartOptions {
* Enables the node inspector, you can connect to this from chrome://inspect
*/
inspect?: boolean;
/**
* Enables the node inspector, you can connect to this from chrome://inspect
* Pauses the execution on first JavaScript line until debugger connects.
*/
inspectBrk?: boolean;
}

export interface InitTemplateOptions {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.