test: exit after app.relaunch is called (#28016)
This commit is contained in:
parent
f114dcfd6e
commit
b3a0743121
3 changed files with 10 additions and 9 deletions
|
@ -295,9 +295,9 @@ describe('app module', () => {
|
|||
const child = cp.spawn(process.execPath, [appPath]);
|
||||
child.stdout.on('data', (c) => console.log(c.toString()));
|
||||
child.stderr.on('data', (c) => console.log(c.toString()));
|
||||
child.on('exit', (code) => {
|
||||
child.on('exit', (code, signal) => {
|
||||
if (code !== 0) {
|
||||
done(`Process exited with code ${code}`);
|
||||
console.log(`Process exited with code "${code}" signal "${signal}"`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -152,13 +152,15 @@ describe('chrome extensions', () => {
|
|||
const [, loadedExtension] = await loadedPromise;
|
||||
const [, readyExtension] = await emittedOnce(customSession, 'extension-ready');
|
||||
|
||||
expect(loadedExtension).to.deep.equal(extension);
|
||||
expect(readyExtension).to.deep.equal(extension);
|
||||
// Compare JSON string to print more information if failed.
|
||||
const expected = JSON.stringify(extension);
|
||||
expect(JSON.stringify(loadedExtension)).to.equal(expected);
|
||||
expect(JSON.stringify(readyExtension)).to.equal(expected);
|
||||
|
||||
const unloadedPromise = emittedOnce(customSession, 'extension-unloaded');
|
||||
await customSession.removeExtension(extension.id);
|
||||
const [, unloadedExtension] = await unloadedPromise;
|
||||
expect(unloadedExtension).to.deep.equal(extension);
|
||||
expect(JSON.stringify(unloadedExtension)).to.equal(expected);
|
||||
});
|
||||
|
||||
it('lists loaded extensions in getAllExtensions', async () => {
|
||||
|
|
7
spec/fixtures/api/relaunch/main.js
vendored
7
spec/fixtures/api/relaunch/main.js
vendored
|
@ -14,10 +14,9 @@ app.whenReady().then(() => {
|
|||
client.end(String(lastArg === '--second'));
|
||||
});
|
||||
client.once('end', () => {
|
||||
if (lastArg !== '--second') {
|
||||
app.relaunch({ args: process.argv.slice(1).concat('--second') });
|
||||
}
|
||||
app.exit(0);
|
||||
});
|
||||
|
||||
if (lastArg !== '--second') {
|
||||
app.relaunch({ args: process.argv.slice(1).concat('--second') });
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue