Skip to content

Commit

Permalink
fix(core): fix start specs
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed May 14, 2018
1 parent bd35ecd commit 987161e
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions packages/api/core/test/fast/start_spec.ts
Expand Up @@ -26,6 +26,7 @@ describe('start', () => {
triggerHook: async () => false,
},
}),
[path.resolve(__dirname, 'node_modules/electron')]: 'fake_electron_path',
'../util/resolve-dir': async (dir: string) => resolveStub(dir),
'../util/read-package-json': () => Promise.resolve(packageJSON),
'../util/rebuild': () => Promise.resolve(),
Expand All @@ -42,8 +43,7 @@ describe('start', () => {
interactive: false,
});
expect(spawnStub.callCount).to.equal(1);
expect(spawnStub.firstCall.args[0]).to.equal(process.execPath);
expect(spawnStub.firstCall.args[1][0]).to.contain(`electron${path.sep}cli`);
expect(spawnStub.firstCall.args[0]).to.equal('fake_electron_path');
expect(spawnStub.firstCall.args[2]).to.have.property('cwd', __dirname);
expect(spawnStub.firstCall.args[2].env).to.not.have.property('ELECTRON_ENABLE_LOGGING');
});
Expand All @@ -64,9 +64,8 @@ describe('start', () => {
dir: __dirname,
});
expect(spawnStub.callCount).to.equal(1);
expect(spawnStub.firstCall.args[0]).to.equal(process.execPath);
expect(spawnStub.firstCall.args[1][0]).to.contain(`electron${path.sep}cli`);
expect(spawnStub.firstCall.args[1][1]).to.equal('.');
expect(spawnStub.firstCall.args[0]).to.equal('fake_electron_path');
expect(spawnStub.firstCall.args[1][0]).to.equal('.');
});

it('should pass electron the app path if specified', async () => {
Expand All @@ -76,9 +75,8 @@ describe('start', () => {
appPath: '/path/to/app.js',
});
expect(spawnStub.callCount).to.equal(1);
expect(spawnStub.firstCall.args[0]).to.equal(process.execPath);
expect(spawnStub.firstCall.args[1][0]).to.contain(`electron${path.sep}cli`);
expect(spawnStub.firstCall.args[1][1]).to.equal('/path/to/app.js');
expect(spawnStub.firstCall.args[0]).to.equal('fake_electron_path');
expect(spawnStub.firstCall.args[1][0]).to.equal('/path/to/app.js');
});

it('should enable electron logging if enableLogging=true', async () => {
Expand All @@ -89,8 +87,7 @@ describe('start', () => {
enableLogging: true,
});
expect(spawnStub.callCount).to.equal(1);
expect(spawnStub.firstCall.args[0]).to.equal(process.execPath);
expect(spawnStub.firstCall.args[1][0]).to.contain(`electron${path.sep}cli`);
expect(spawnStub.firstCall.args[0]).to.equal('fake_electron_path');
expect(spawnStub.firstCall.args[2].env).to.have.property('ELECTRON_ENABLE_LOGGING', 'true');
});

Expand Down Expand Up @@ -146,8 +143,8 @@ describe('start', () => {
interactive: false,
});
expect(spawnStub.callCount).to.equal(1);
expect(spawnStub.firstCall.args[0]).to.equal(process.execPath);
expect(spawnStub.firstCall.args[1].slice(2)).to.deep.equal(args);
expect(spawnStub.firstCall.args[0]).to.equal('fake_electron_path');
expect(spawnStub.firstCall.args[1].slice(1)).to.deep.equal(args);
});

it('should pass --inspect at the start of the args if inspect is set', async () => {
Expand All @@ -161,8 +158,8 @@ describe('start', () => {
inspect: true,
});
expect(spawnStub.callCount).to.equal(1);
expect(spawnStub.firstCall.args[0]).to.equal(process.execPath);
expect(spawnStub.firstCall.args[1].slice(2)).to.deep.equal(['--inspect'].concat(args));
expect(spawnStub.firstCall.args[0]).to.equal('fake_electron_path');
expect(spawnStub.firstCall.args[1].slice(1)).to.deep.equal(['--inspect'].concat(args));
});

it('should resolve with a handle to the spawned instance', async () => {
Expand Down

0 comments on commit 987161e

Please sign in to comment.