Skip to content
Permalink
Browse files

fix(core): fix start specs

  • Loading branch information
MarshallOfSound committed May 14, 2018
1 parent bd35ecd commit 987161e5df22ee200ca81071d660e6cba541093e
Showing with 11 additions and 14 deletions.
  1. +11 −14 packages/api/core/test/fast/start_spec.ts
@@ -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(),
@@ -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');
});
@@ -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 () => {
@@ -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 () => {
@@ -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');
});

@@ -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 () => {
@@ -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 () => {

0 comments on commit 987161e

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