Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Michael/plugins #108

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
40 changes: 39 additions & 1 deletion packages/testwatch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

if (!isSupported) {
/* c8 ignore next 3 */
console.log(chalk.magenta('Node.js <= 20.3.0 is not supported.'));

Check warning on line 16 in packages/testwatch/index.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 16 in packages/testwatch/index.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 16 in packages/testwatch/index.js

View workflow job for this annotation

GitHub Actions / tests (v21)

Unexpected console statement
process.exit(0);
}
// eslint-disable-next-line import/no-unresolved, import/order
const { spec: SpecReporter } = require('node:test/reporters');
const WatchSuspendPlugin = require('./tests/fixtures/suspend-plugin');

const KEYS = {
CTRLC: '\x03',
Expand All @@ -41,6 +42,11 @@
class REPL {
#controller = new AbortController();

#hooks = {
shouldRunTestSuite: [],
onTestRunComplete: [],
};

#filesFilter = process.argv[2] || '';

#testsFilter = '';
Expand All @@ -62,12 +68,20 @@
this.#clear();
this.#controller.abort();
this.#controller = new AbortController();
if (this.#hooks.shouldRunTestSuite.some((fn) => !fn())) {
this.#clear();
this.#emitter.emit('drained');
this.#hooks.onTestRunComplete.forEach((fn) => fn());
return;
}

const filter = this.#filesFilter ? `**/${this.#filesFilter}*.*` : '**/?(*.)+(spec|test).[jt]s';
const files = await glob(filter, { ignore: 'node_modules/**' });

if (!files.length) {
process.stdout.write(chalk.red(`\nNo files found for pattern ${filter}\n`));
this.#emitter.emit('drained');
this.#hooks.onTestRunComplete.forEach((fn) => fn());
return;
}

Expand All @@ -80,7 +94,7 @@
watch: true,
testNamePatterns: this.#testsFilter,
}),
async function* (source) {

Check warning on line 97 in packages/testwatch/index.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected unnamed async generator function

Check warning on line 97 in packages/testwatch/index.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected unnamed async generator function

Check warning on line 97 in packages/testwatch/index.js

View workflow job for this annotation

GitHub Actions / tests (v21)

Unexpected unnamed async generator function
for await (const data of source) {
yield data;
if (drained && (data.type === 'test:start' || data.type === 'test:enqueue')) {
Expand All @@ -92,6 +106,7 @@
setImmediate(() => {
this.#emitter.emit('drained');
drained = true;
this.#hooks.onTestRunComplete.forEach((fn) => fn());
});
}
}
Expand Down Expand Up @@ -239,12 +254,35 @@
}
}
}

registerPlugin(plugin) {
// TODO: should we be compatible (as much as possible) to Jest API for easy migration?
const usageInfo = plugin.getUsageInfo();

// TODO: enable override t,p overridable
this.#currentCommands = Object.freeze({
[usageInfo.key]: {
fn: plugin.run.bind(plugin),
description: usageInfo.description,
},
...this.#currentCommands,
});

plugin.apply({
shouldRunTestSuite: (fn) => this.#hooks.shouldRunTestSuite.push(fn),
onTestRunComplete: (fn) => this.#hooks.onTestRunComplete.push(fn),
});
}
}

new REPL().run()
const repl = new REPL();
// TODO: only for testing/development. remove this after we have config.
repl.registerPlugin(new WatchSuspendPlugin());

repl.run()
.then(() => process.exit(0))
.catch((error) => {
/* c8 ignore next 2 */
console.error(error);

Check warning on line 286 in packages/testwatch/index.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 286 in packages/testwatch/index.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 286 in packages/testwatch/index.js

View workflow job for this annotation

GitHub Actions / tests (v21)

Unexpected console statement
process.exit(1);
});
33 changes: 33 additions & 0 deletions packages/testwatch/tests/fixtures/suspend-plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

const chalk = require('chalk');

module.exports = class WatchSuspendPlugin {
constructor() {
this.suspend = false;
}

apply(hooks) {
hooks.shouldRunTestSuite(() => !this.suspend);
hooks.onTestRunComplete(() => {
if (this.suspend) {
console.info(chalk.bold('\nTest is suspended.'));

Check warning on line 14 in packages/testwatch/tests/fixtures/suspend-plugin.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 14 in packages/testwatch/tests/fixtures/suspend-plugin.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 14 in packages/testwatch/tests/fixtures/suspend-plugin.js

View workflow job for this annotation

GitHub Actions / tests (v21)

Unexpected console statement
}
});
}

// eslint-disable-next-line class-methods-use-this
getUsageInfo() {
return {
key: 's',
description: 'suspend watch mode',
};
}

run() {
this.suspend = !this.suspend;
if (this.suspend) {
console.info(chalk.bold('\nTest is suspended.'));

Check warning on line 30 in packages/testwatch/tests/fixtures/suspend-plugin.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 30 in packages/testwatch/tests/fixtures/suspend-plugin.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 30 in packages/testwatch/tests/fixtures/suspend-plugin.js

View workflow job for this annotation

GitHub Actions / tests (v21)

Unexpected console statement
}
}
};
21 changes: 19 additions & 2 deletions packages/testwatch/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
`;
const mainMenuWithFilters = mainMenu.replace('REPL Usage', `REPL Usage
› Press c to clear the filters.`);
const mainMenuWithPlugin = mainMenu.replace('REPL Usage', 'REPL Usage\n'
+ ' › Press s to suspend watch mode');
const compactMenu = '\nREPL Usage: Press w to show more.';
const filterTestsPrompt = `
Filter Test
Expand Down Expand Up @@ -84,7 +86,9 @@
stdout += data;
pending.stdout += data;
const s = pending.stdout;
if (s.includes(mainMenu) || s.includes(mainMenuWithFilters) || s.includes(compactMenu)) {
// TODO: can we check only the last line of each possible option?
if (s.includes(mainMenu) || s.includes(mainMenuWithFilters)
|| s.includes(compactMenu) || s.includes(mainMenuWithPlugin)) {
pending.resolve();
}
});
Expand All @@ -105,22 +109,21 @@
});
});
}

describe('testwatch', { concurrency: true, skip: !isSupported ? 'unsupported node version' : false }, () => {
it('should run all tests on initialization', async () => {
const { outputs, stderr } = await spawnInteractive('q');
assert.strictEqual(stderr, '');
assert.deepStrictEqual(outputs, ['', '', `${tests}\n${mainMenu}\n`]);

Check failure on line 116 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v20)

should run all tests on initialization

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:116:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:216:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], operator: 'deepStrictEqual' } }

Check failure on line 116 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v18)

should run all tests on initialization

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 0) { failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:116:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:214:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], operator: 'deepStrictEqual' }, code: 'ERR_TEST_FAILURE' }

Check failure on line 116 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v21)

should run all tests on initialization

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:116:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:640:9) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:964:7) at async startSubtest (node:internal/test_runner/harness:218:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], operator: 'deepStrictEqual' } }
});
it('should handle CTR + C', async () => {
const { outputs, stderr } = await spawnInteractive('\x03');
assert.strictEqual(stderr, '');
assert.deepStrictEqual(outputs, ['', '', `${tests}\n${mainMenu}\n`]);

Check failure on line 121 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v20)

should handle CTR + C

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 1) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:121:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 1) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:216:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], operator: 'deepStrictEqual' } }

Check failure on line 121 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v18)

should handle CTR + C

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 1) { failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:121:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 1) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:214:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], operator: 'deepStrictEqual' }, code: 'ERR_TEST_FAILURE' }

Check failure on line 121 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v21)

should handle CTR + C

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 1) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:121:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:640:9) at async Promise.all (index 1) at async Suite.run (node:internal/test_runner/test:964:7) at async startSubtest (node:internal/test_runner/harness:218:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], operator: 'deepStrictEqual' } }
});
it('should handle CTR + D', async () => {
const { outputs, stderr } = await spawnInteractive('\x04');
assert.strictEqual(stderr, '');
assert.deepStrictEqual(outputs, ['', '', `${tests}\n${mainMenu}\n`]);

Check failure on line 126 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v20)

should handle CTR + D

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 2) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:126:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 2) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:216:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], operator: 'deepStrictEqual' } }

Check failure on line 126 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v18)

should handle CTR + D

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 2) { failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:126:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 2) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:214:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], operator: 'deepStrictEqual' }, code: 'ERR_TEST_FAILURE' }

Check failure on line 126 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v21)

should handle CTR + D

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 2) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:126:12) at async Test.run (node:internal/test_runner/test:640:9) at async Promise.all (index 2) at async Suite.run (node:internal/test_runner/test:964:7) at async startSubtest (node:internal/test_runner/harness:218:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n\n' ], operator: 'deepStrictEqual' } }
});
it('should exit on sigkill', async () => {
const child = spawn(process.execPath, ['../../index.js'], {
Expand All @@ -142,17 +145,17 @@
it('should run all tests on "a"', async () => {
const { outputs, stderr } = await spawnInteractive('aq');
assert.strictEqual(stderr, '');
assert.deepStrictEqual(outputs, ['', '', `${tests}\n${mainMenu}`, '', `${tests}\n${compactMenu}\n`]);

Check failure on line 148 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v20)

should run all tests on "a"

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at async Promise.all (index 4) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:148:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 4) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:216:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], operator: 'deepStrictEqual' } }

Check failure on line 148 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v18)

should run all tests on "a"

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at async Promise.all (index 4) { failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:148:12) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 4) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:214:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], operator: 'deepStrictEqual' }, code: 'ERR_TEST_FAILURE' }

Check failure on line 148 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v21)

should run all tests on "a"

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at async Promise.all (index 4) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:148:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:640:9) at async Promise.all (index 4) at async Suite.run (node:internal/test_runner/test:964:7) at async startSubtest (node:internal/test_runner/harness:218:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], operator: 'deepStrictEqual' } }
});
it('should run all tests on Enter', async () => {
const { outputs, stderr } = await spawnInteractive('\rq');
assert.strictEqual(stderr, '');
assert.deepStrictEqual(outputs, ['', '', `${tests}\n${mainMenu}`, '', `${tests}\n${compactMenu}\n`]);

Check failure on line 153 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v20)

should run all tests on Enter

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at async Promise.all (index 5) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:153:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 5) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:216:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], operator: 'deepStrictEqual' } }

Check failure on line 153 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v18)

should run all tests on Enter

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at async Promise.all (index 5) { failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:153:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 5) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:214:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], operator: 'deepStrictEqual' }, code: 'ERR_TEST_FAILURE' }

Check failure on line 153 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v21)

should run all tests on Enter

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at async Promise.all (index 5) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + ' › Press a to run all tests.\n' + ... '\n' + 'REPL Usage: Press w to show more.\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:153:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:640:9) at async Promise.all (index 5) at async Suite.run (node:internal/test_runner/test:964:7) at async startSubtest (node:internal/test_runner/harness:218:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], expected: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n' ], operator: 'deepStrictEqual' } }
});
it('should show full menu on "w" after running tests', async () => {
const { outputs, stderr } = await spawnInteractive('awq');
assert.strictEqual(stderr, '');
assert.deepStrictEqual(outputs, [

Check failure on line 158 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v20)

should show full menu on "w" after running tests

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + + ' › Press a to run all tests.\n' + + ' › Press p to filter by a file name pattern.\n' + + ' › Press t to filter by a test name pattern.\n' + + ' › Press q to quit.\n' + + ' › Press Enter to trigger a test run.\n', + '', + '✔ j - sum (*ms)\n' + + '✔ j - subtraction (*ms)\n' + + '✔ index - sum (*ms)\n' + + '✔ index - subtraction (*ms)\n' + + '\n' + + 'REPL Usage: Press w to show more.\n' + + '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + - ' › Press a to run all tests.\n' + - ' › Press p to filter by a file name pattern.\n' + - ' › Press t to filter by a test name pattern.\n' + - ' › Press q to quit.\n' + - ' › Press Enter to trigger a test run.\n', - '', - '✔ j - sum (*ms)\n' + - '✔ j - subtraction (*ms)\n' + - '✔ index - sum (*ms)\n' + - '✔ index - subtraction (*ms)\n' + - '\n' + - 'REPL Usage: Press w to show more.\n' + - '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + - 'REPL Usage\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 6) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + + ' › Press a to run all tests.\n' + + ' › Press p to filter by a file name pattern.\n' + + ' › Press t to filter by a test name pattern.\n' + + ' › Press q to quit.\n' + + ' › Press Enter to trigger a test run.\n', + '', + '✔ j - sum (*ms)\n' + + '✔ j - subtraction (*ms)\n' + + '✔ index - sum (*ms)\n' + + '✔ index - subtraction (*ms)\n' + + '\n' + + 'REPL Usage: Press w to show more.\n' + + '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + - ' › Press a to run all tests.\n' + - ' › Press p to filter by a file name pattern.\n' + - ' › Press t to filter by a test name pattern.\n' + - ' › Press q to quit.\n' + - ' › Press Enter to trigger a test run.\n', - '', - '✔ j - sum (*ms)\n' + - '✔ j - subtraction (*ms)\n' + - '✔ index - sum (*ms)\n' + - '✔ index - subtraction (*ms)\n' + - '\n' + - 'REPL Usage: Press w to show more.\n' + - '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + - 'REPL Usage\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:158:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 6) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:216:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n\x1B[1A\x1B[2K\x1B[1A\x1B[2K\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n

Check failure on line 158 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v18)

should show full menu on "w" after running tests

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + + ' › Press a to run all tests.\n' + + ' › Press p to filter by a file name pattern.\n' + + ' › Press t to filter by a test name pattern.\n' + + ' › Press q to quit.\n' + + ' › Press Enter to trigger a test run.\n', + '', + '✔ j - sum (*ms)\n' + + '✔ j - subtraction (*ms)\n' + + '✔ index - sum (*ms)\n' + + '✔ index - subtraction (*ms)\n' + + '\n' + + 'REPL Usage: Press w to show more.\n' + + '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + - ' › Press a to run all tests.\n' + - ' › Press p to filter by a file name pattern.\n' + - ' › Press t to filter by a test name pattern.\n' + - ' › Press q to quit.\n' + - ' › Press Enter to trigger a test run.\n', - '', - '✔ j - sum (*ms)\n' + - '✔ j - subtraction (*ms)\n' + - '✔ index - sum (*ms)\n' + - '✔ index - subtraction (*ms)\n' + - '\n' + - 'REPL Usage: Press w to show more.\n' + - '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + - 'REPL Usage\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 6) { failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + + ' › Press a to run all tests.\n' + + ' › Press p to filter by a file name pattern.\n' + + ' › Press t to filter by a test name pattern.\n' + + ' › Press q to quit.\n' + + ' › Press Enter to trigger a test run.\n', + '', + '✔ j - sum (*ms)\n' + + '✔ j - subtraction (*ms)\n' + + '✔ index - sum (*ms)\n' + + '✔ index - subtraction (*ms)\n' + + '\n' + + 'REPL Usage: Press w to show more.\n' + + '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + - ' › Press a to run all tests.\n' + - ' › Press p to filter by a file name pattern.\n' + - ' › Press t to filter by a test name pattern.\n' + - ' › Press q to quit.\n' + - ' › Press Enter to trigger a test run.\n', - '', - '✔ j - sum (*ms)\n' + - '✔ j - subtraction (*ms)\n' + - '✔ index - sum (*ms)\n' + - '✔ index - subtraction (*ms)\n' + - '\n' + - 'REPL Usage: Press w to show more.\n' + - '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + - 'REPL Usage\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:158:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:632:9) at async Promise.all (index 6) at async Suite.run (node:internal/test_runner/test:948:7) at async startSubtest (node:internal/test_runner/harness:214:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n\x1B[1A\x1B[2K\x1B[1A\x1B[2K\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Pres

Check failure on line 158 in packages/testwatch/tests/index.test.js

View workflow job for this annotation

GitHub Actions / tests (v21)

should show full menu on "w" after running tests

Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + + ' › Press a to run all tests.\n' + + ' › Press p to filter by a file name pattern.\n' + + ' › Press t to filter by a test name pattern.\n' + + ' › Press q to quit.\n' + + ' › Press Enter to trigger a test run.\n', + '', + '✔ j - sum (*ms)\n' + + '✔ j - subtraction (*ms)\n' + + '✔ index - sum (*ms)\n' + + '✔ index - subtraction (*ms)\n' + + '\n' + + 'REPL Usage: Press w to show more.\n' + + '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + - ' › Press a to run all tests.\n' + - ' › Press p to filter by a file name pattern.\n' + - ' › Press t to filter by a test name pattern.\n' + - ' › Press q to quit.\n' + - ' › Press Enter to trigger a test run.\n', - '', - '✔ j - sum (*ms)\n' + - '✔ j - subtraction (*ms)\n' + - '✔ index - sum (*ms)\n' + - '✔ index - subtraction (*ms)\n' + - '\n' + - 'REPL Usage: Press w to show more.\n' + - '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + - 'REPL Usage\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at async Promise.all (index 6) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected ... Lines skipped [ '', ... '\n' + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + + ' › Press a to run all tests.\n' + + ' › Press p to filter by a file name pattern.\n' + + ' › Press t to filter by a test name pattern.\n' + + ' › Press q to quit.\n' + + ' › Press Enter to trigger a test run.\n', + '', + '✔ j - sum (*ms)\n' + + '✔ j - subtraction (*ms)\n' + + '✔ index - sum (*ms)\n' + + '✔ index - subtraction (*ms)\n' + + '\n' + + 'REPL Usage: Press w to show more.\n' + + '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + + 'REPL Usage\n' + + ' › Press s to suspend watch mode\n' + - ' › Press a to run all tests.\n' + - ' › Press p to filter by a file name pattern.\n' + - ' › Press t to filter by a test name pattern.\n' + - ' › Press q to quit.\n' + - ' › Press Enter to trigger a test run.\n', - '', - '✔ j - sum (*ms)\n' + - '✔ j - subtraction (*ms)\n' + - '✔ index - sum (*ms)\n' + - '✔ index - subtraction (*ms)\n' + - '\n' + - 'REPL Usage: Press w to show more.\n' + - '\x1B[1A\x1B[2K\x1B[1A\x1B[2K\n' + - 'REPL Usage\n' + ' › Press a to run all tests.\n' + ... ' › Press Enter to trigger a test run.\n' + '\n' ] at TestContext.<anonymous> (/home/runner/work/reporters/reporters/packages/testwatch/tests/index.test.js:158:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:640:9) at async Promise.all (index 6) at async Suite.run (node:internal/test_runner/test:964:7) at async startSubtest (node:internal/test_runner/harness:218:3) { generatedMessage: true, code: 'ERR_ASSERTION', actual: [ '', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n › Press q to quit.\n › Press Enter to trigger a test run.\n', '', '✔ j - sum (*ms)\n✔ j - subtraction (*ms)\n✔ index - sum (*ms)\n✔ index - subtraction (*ms)\n\nREPL Usage: Press w to show more.\n\x1B[1A\x1B[2K\x1B[1A\x1B[2K\nREPL Usage\n › Press s to suspend watch mode\n › Press a to run all tests.\n › Press p to filter by a file name pattern.\n › Press t to filter by a test name pattern.\n
'',
'',
`${tests}\n${mainMenu}`,
Expand Down Expand Up @@ -296,4 +299,18 @@
assert.match(outputs[5], /No files found for pattern \*\*\/noth1ing\*\.\*/);
});
});

describe('Plugins', () => {
it('should suspend the watch mode', async () => {
const { outputs, stderr } = await spawnInteractive(['s', '\r', 'q']);
assert.strictEqual(stderr, '');
assert.deepStrictEqual(outputs, [
'',
'',
`${tests}\n${mainMenuWithPlugin}\nTest is suspended.\n`,
'',
`${compactMenu}\nTest is suspended.\n\n`,
]);
});
});
});
Loading