Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions lib/internal/main/watch_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ function start() {
}
child.once('exit', (code) => {
exited = true;
const waitingForChanges = 'Waiting for file changes before restarting...';
if (code === 0) {
process.stdout.write(`${blue}Completed running ${kCommandStr}${white}\n`);
process.stdout.write(`${blue}Completed running ${kCommandStr}. ${waitingForChanges}${white}\n`);
} else {
process.stdout.write(`${red}Failed running ${kCommandStr}${white}\n`);
process.stdout.write(`${red}Failed running ${kCommandStr}. ${waitingForChanges}${white}\n`);
}
});
return child;
Expand Down
90 changes: 45 additions & 45 deletions test/sequential/test-watch-mode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ describe('watch mode', { concurrency: !process.env.TEST_PARALLEL, timeout: 60_00
assert.strictEqual(stderr, '');
assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -185,10 +185,10 @@ describe('watch mode', { concurrency: !process.env.TEST_PARALLEL, timeout: 60_00
assert.strictEqual(stderr, '');
assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -209,7 +209,7 @@ describe('watch mode', { concurrency: !process.env.TEST_PARALLEL, timeout: 60_00
assert.deepStrictEqual(stdout, [
`Restarting ${inspect(jsFile)}`,
'ENV: value2',
`Completed running ${inspect(jsFile)}`,
`Completed running ${inspect(jsFile)}. Waiting for file changes before restarting...`,
]);
} finally {
await done();
Expand All @@ -235,7 +235,7 @@ describe('watch mode', { concurrency: !process.env.TEST_PARALLEL, timeout: 60_00
`Restarting ${inspect(jsFile)}`,
'ENV: value1',
'ENV2: newValue',
`Completed running ${inspect(jsFile)}`,
`Completed running ${inspect(jsFile)}. Waiting for file changes before restarting...`,
]);
} finally {
await done();
Expand All @@ -261,7 +261,7 @@ describe('watch mode', { concurrency: !process.env.TEST_PARALLEL, timeout: 60_00
`Restarting ${inspect(jsFile)}`,
'ENV: value1',
'ENV2: newValue',
`Completed running ${inspect(jsFile)}`,
`Completed running ${inspect(jsFile)}. Waiting for file changes before restarting...`,
]);
} finally {
await done();
Expand All @@ -279,9 +279,9 @@ describe('watch mode', { concurrency: !process.env.TEST_PARALLEL, timeout: 60_00

assert.match(stderr, /Error: fails\r?\n/);
assert.deepStrictEqual(stdout, [
`Failed running ${inspect(file)}`,
`Failed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
`Failed running ${inspect(file)}`,
`Failed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -298,10 +298,10 @@ describe('watch mode', { concurrency: !process.env.TEST_PARALLEL, timeout: 60_00
assert.strictEqual(stderr, '');
assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
assert.strictEqual(stderr, '');
});
Expand All @@ -324,9 +324,9 @@ describe('watch mode', { concurrency: !process.env.TEST_PARALLEL, timeout: 60_00

assert.match(stderr, /Error: Cannot find module/g);
assert.deepStrictEqual(stdout, [
`Failed running ${inspect(file)}`,
`Failed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
`Failed running ${inspect(file)}`,
`Failed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -348,9 +348,9 @@ describe('watch mode', { concurrency: !process.env.TEST_PARALLEL, timeout: 60_00

assert.match(stderr, /Error: Cannot find module/g);
assert.deepStrictEqual(stdout, [
`Failed running ${inspect(file)}`,
`Failed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
`Failed running ${inspect(file)}`,
`Failed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand Down Expand Up @@ -380,10 +380,10 @@ console.log(dependency);
assert.strictEqual(stderr, '');
assert.deepStrictEqual(stdout, [
'{}',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'{}',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -398,10 +398,10 @@ console.log(dependency);
assert.strictEqual(stderr, '');
assert.deepStrictEqual(stdout, [
'{}',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'{}',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -412,13 +412,13 @@ console.log(dependency);
assert.strictEqual(stderr, '');
assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -435,10 +435,10 @@ console.log(values.random);
assert.strictEqual(stderr, '');
assert.deepStrictEqual(stdout, [
random,
`Completed running ${inspect(`${file} --random ${random}`)}`,
`Completed running ${inspect(`${file} --random ${random}`)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(`${file} --random ${random}`)}`,
random,
`Completed running ${inspect(`${file} --random ${random}`)}`,
`Completed running ${inspect(`${file} --random ${random}`)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -452,10 +452,10 @@ console.log(values.random);
assert.notStrictEqual(pid, importPid);
assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -472,10 +472,10 @@ console.log(values.random);

assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand Down Expand Up @@ -521,10 +521,10 @@ console.log(values.random);
assert.strictEqual(stderr, '');
assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -536,10 +536,10 @@ console.log(values.random);
assert.strictEqual(stderr, '');
assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand Down Expand Up @@ -567,11 +567,11 @@ console.log(values.random);
assert.deepStrictEqual(stdout, [
'hello',
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'hello',
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand Down Expand Up @@ -599,11 +599,11 @@ console.log(values.random);
assert.deepStrictEqual(stdout, [
'hello',
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'hello',
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand Down Expand Up @@ -631,11 +631,11 @@ console.log(values.random);
assert.deepStrictEqual(stdout, [
'hello',
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'hello',
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand Down Expand Up @@ -663,11 +663,11 @@ console.log(values.random);
assert.deepStrictEqual(stdout, [
'hello',
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'hello',
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -679,10 +679,10 @@ console.log(values.random);
assert.match(stderr, /listening on ws:\/\//);
assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand All @@ -704,11 +704,11 @@ console.log(values.random);
assert.deepStrictEqual(stdout, [
'hello',
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
`Restarting ${inspect(file)}`,
'hello',
'running',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});

Expand Down Expand Up @@ -788,7 +788,7 @@ process.on('message', (message) => {
`Restarting ${inspect(file)}`,
'running',
'Received: second message',
`Completed running ${inspect(file)}`,
`Completed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
});
});
Loading