Skip to content

Commit

Permalink
Change test fixture so tests pass on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rzhao271 committed Oct 25, 2021
1 parent ff49371 commit 8307935
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -141,4 +141,4 @@
"node script/gen-hunspell-filenames.js"
]
}
}
}
15 changes: 5 additions & 10 deletions spec-main/api-app-spec.ts
Expand Up @@ -218,6 +218,7 @@ describe('app module', () => {
await emittedOnce(first.stdout, 'data');
// Start second app when received output.
const second = cp.spawn(process.execPath, [appPath]);

const [code2] = await emittedOnce(second, 'exit');
expect(code2).to.equal(1);
const [code1] = await emittedOnce(first, 'exit');
Expand All @@ -238,9 +239,11 @@ describe('app module', () => {
const secondInstanceArgs = [process.execPath, appPath, ...testArgs.args, '--some-switch', 'some-arg'];
const second = cp.spawn(secondInstanceArgs[0], secondInstanceArgs.slice(1));
const secondStdoutLines = second.stdout.pipe(split());
const dataAckPromise = emittedOnce(secondStdoutLines, 'data');
let ackData;
while ((ackData = await emittedOnce(secondStdoutLines, 'data'))[0].toString().length === 0) {
// This isn't valid data.
}

const ackData = await dataAckPromise;
const [code2] = await emittedOnce(second, 'exit');
expect(code2).to.equal(1);
const [code1] = await emittedOnce(first, 'exit');
Expand Down Expand Up @@ -312,14 +315,6 @@ describe('app module', () => {
});
});

it('gets back an empty ack by default', async () => {
await testArgumentPassing({
args: ['--send-ack'],
expectedAdditionalData: null,
expectedAck: null
});
});

it('sends and receives data', async () => {
await testArgumentPassing({
args: ['--send-ack', '--prevent-default', '--send-data'],
Expand Down
4 changes: 3 additions & 1 deletion spec/fixtures/api/singleton-data/main.js
Expand Up @@ -44,7 +44,9 @@ app.on('second-instance', (event, args, workingDirectory, data, ackCallback) =>
setImmediate(() => {
console.log([JSON.stringify(args), JSON.stringify(data)].join('||'));
sendAck ? ackCallback(ackObj) : ackCallback();
app.exit(0);
setImmediate(() => {
app.exit(0);
});
});
});

Expand Down

0 comments on commit 8307935

Please sign in to comment.