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

chore: fix typos #129

Merged
merged 2 commits into from
Sep 25, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Object {
::debug::starting to run is ok
::debug::completed running is ok
::debug::starting to run fails
::error title=fails,file=tests/example.js,line=9,col=11::Error [ERR_TEST_FAILURE]: this is an error%0A at async Promise.all (index 0) {%0A code: 'ERR_TEST_FAILURE',%0A failureType: 'testCodeFailure',%0A cause: Error: this is an error%0A at TestContext.<anonymous> (CWD/tests/example.js:9:11)%0A at Test.runInAsyncScope (node:async_hooks:211:14)%0A at Test.run (node:internal/test_runner/test:887:25)%0A at Suite.processPendingSubtests (node:internal/test_runner/test:584:18)%0A at Test.postRun (node:internal/test_runner/test:983:19)%0A at Test.run (node:internal/test_runner/test:926:12)%0A at async Promise.all (index 0)%0A at async Suite.run (node:internal/test_runner/test:1268:7)%0A at async startSubtestAfterBootstrap (node:internal/test_runner/harness:280:3)%0A}
::error title=fails,file=tests/example.js,line=9,col=11::Error [ERR_TEST_FAILURE]: this is an error%0A at async Promise.all (index 0) {%0A code: 'ERR_TEST_FAILURE',%0A failureType: 'testCodeFailure',%0A cause: Error: this is an error%0A at TestContext.<anonymous> (CWD/tests/example.js:9:11)%0A at Test.runInAsyncScope (node:async_hooks:211:14)%0A at Test.run (node:internal/test_runner/test:930:25)%0A at Suite.processPendingSubtests (node:internal/test_runner/test:629:18)%0A at Test.postRun (node:internal/test_runner/test:1026:19)%0A at Test.run (node:internal/test_runner/test:969:12)%0A at async Promise.all (index 0)%0A at async Suite.run (node:internal/test_runner/test:1295:7)%0A at async startSubtestAfterBootstrap (node:internal/test_runner/harness:289:3)%0A}
::debug::starting to run is a diagnostic
::debug::completed running is a diagnostic
::notice file=tests/example.js,line=11,col=3::this is a diagnostic
::debug::starting to run should fail
::error title=should fail,file=tests/example.js,line=12,col=31::[Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value:%0A%0A assert(false)%0A] {%0A code: 'ERR_TEST_FAILURE',%0A failureType: 'testCodeFailure',%0A cause: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:%0A %0A assert(false)%0A %0A at TestContext.<anonymous> (CWD/tests/example.js:12:31)%0A at Test.runInAsyncScope (node:async_hooks:211:14)%0A at Test.run (node:internal/test_runner/test:887:25)%0A at Suite.processPendingSubtests (node:internal/test_runner/test:584:18)%0A at Test.postRun (node:internal/test_runner/test:983:19)%0A at Test.run (node:internal/test_runner/test:926:12)%0A at async Suite.processPendingSubtests (node:internal/test_runner/test:584:7) {%0A generatedMessage: true,%0A code: 'ERR_ASSERTION',%0A actual: false,%0A expected: true,%0A operator: '=='%0A }%0A}
::error title=should fail,file=tests/example.js,line=12,col=31::[Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value:%0A%0A assert(false)%0A] {%0A code: 'ERR_TEST_FAILURE',%0A failureType: 'testCodeFailure',%0A cause: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:%0A %0A assert(false)%0A %0A at TestContext.<anonymous> (CWD/tests/example.js:12:31)%0A at Test.runInAsyncScope (node:async_hooks:211:14)%0A at Test.run (node:internal/test_runner/test:930:25)%0A at Suite.processPendingSubtests (node:internal/test_runner/test:629:18)%0A at Test.postRun (node:internal/test_runner/test:1026:19)%0A at Test.run (node:internal/test_runner/test:969:12)%0A at async Suite.processPendingSubtests (node:internal/test_runner/test:629:7) {%0A generatedMessage: true,%0A code: 'ERR_ASSERTION',%0A actual: false,%0A expected: true,%0A operator: '=='%0A }%0A}
::debug::starting to run more tests
::debug::starting to run is ok
::debug::completed running is ok
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Object {
"exitCode": 1,
"stderr": "",
"stdout": "::debug::starting to run should fail
::error title=should fail,file=tests/example.mjs,line=5,col=3::[Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value:%0A%0A assert(false)%0A] {%0A code: 'ERR_TEST_FAILURE',%0A failureType: 'testCodeFailure',%0A cause: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:%0A %0A assert(false)%0A %0A at TestContext.<anonymous> (file://CWD/tests/example.mjs:5:3)%0A at Test.runInAsyncScope (node:async_hooks:211:14)%0A at Test.run (node:internal/test_runner/test:887:25)%0A at Test.start (node:internal/test_runner/test:786:17)%0A at startSubtestAfterBootstrap (node:internal/test_runner/harness:280:17) {%0A generatedMessage: true,%0A code: 'ERR_ASSERTION',%0A actual: false,%0A expected: true,%0A operator: '=='%0A }%0A}
::error title=should fail,file=tests/example.mjs,line=5,col=3::[Error [ERR_TEST_FAILURE]: The expression evaluated to a falsy value:%0A%0A assert(false)%0A] {%0A code: 'ERR_TEST_FAILURE',%0A failureType: 'testCodeFailure',%0A cause: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:%0A %0A assert(false)%0A %0A at TestContext.<anonymous> (file://CWD/tests/example.mjs:5:3)%0A at Test.runInAsyncScope (node:async_hooks:211:14)%0A at Test.run (node:internal/test_runner/test:930:25)%0A at Test.start (node:internal/test_runner/test:829:17)%0A at startSubtestAfterBootstrap (node:internal/test_runner/harness:289:17) {%0A generatedMessage: true,%0A code: 'ERR_ASSERTION',%0A actual: false,%0A expected: true,%0A operator: '=='%0A }%0A}
::debug::starting to run should pass
::debug::completed running should pass
::group::Test results (1 passed, 1 failed)
Expand Down
2 changes: 1 addition & 1 deletion packages/github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
### Bug Fixes

* line reporting for ERR_TEST_FAILURE ([4fb29f3](https://github.com/MoLow/reporters/commit/4fb29f3fb8a470af8d1a9549adc7d91f465cad91))
* stacktrace misslocated ([33068bf](https://github.com/MoLow/reporters/commit/33068bf98f53f7d6d28678b63d58b4c9b04d8ece))
* stacktrace mislocated ([33068bf](https://github.com/MoLow/reporters/commit/33068bf98f53f7d6d28678b63d58b4c9b04d8ece))


### Documentation
Expand Down
8 changes: 4 additions & 4 deletions packages/github/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,22 @@ module.exports = async function githubReporter(source) {
break;
}
}
const formatedDiagnostics = diagnostics.map((d) => {
const formattedDiagnostics = diagnostics.map((d) => {
const [key, ...rest] = d.split(' ');
const value = rest.join(' ');
return [
DIAGNOSTIC_KEYS[key] ?? key,
DIAGNOSTIC_VALUES[key] ? DIAGNOSTIC_VALUES[key](value) : value,
];
});
core.startGroup(`Test results (${formatedDiagnostics.find(([key]) => key === DIAGNOSTIC_KEYS.pass)?.[1] ?? counter.pass} passed, ${formatedDiagnostics.find(([key]) => key === DIAGNOSTIC_KEYS.fail)?.[1] ?? counter.fail} failed)`);
core.notice(formatedDiagnostics.map((d) => d.join(': ')).join(EOL));
core.startGroup(`Test results (${formattedDiagnostics.find(([key]) => key === DIAGNOSTIC_KEYS.pass)?.[1] ?? counter.pass} passed, ${formattedDiagnostics.find(([key]) => key === DIAGNOSTIC_KEYS.fail)?.[1] ?? counter.fail} failed)`);
core.notice(formattedDiagnostics.map((d) => d.join(': ')).join(EOL));
core.endGroup();

if (process.env.GITHUB_STEP_SUMMARY) {
await core.summary
.addHeading('Test Results')
.addTable(formatedDiagnostics)
.addTable(formattedDiagnostics)
.write();
}
};
4 changes: 2 additions & 2 deletions packages/junit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Junit Reporter
A Junit reporter for `node:test`.
intendend for use with major CI tools like Jenkins, CircleCI, etc that consume Junit reports.
intended for use with major CI tools like Jenkins, CircleCI, etc that consume Junit reports.

## Installation

Expand All @@ -24,7 +24,7 @@ node --test \

## Example

Ouput of the following test file:
Output of the following test file:

```js
const { describe, it } = require('node:test');
Expand Down
4 changes: 2 additions & 2 deletions packages/junit/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const { Snap, nodeMajor } = require('../../../tests/utils');

const snapshot = Snap(`${__filename}.${nodeMajor}`);

test('spwan with reporter', async () => {
test('spawn with reporter', async () => {
const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example'], { env: {} });
await snapshot(child);
});

test('spwan with reporter - esm', async () => {
test('spawn with reporter - esm', async () => {
const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example.mjs'], { env: {} });
await snapshot(child);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/mocha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@
try {
Reporter = await import(reporterName).then((m) => m.default || m);
} catch (err) {
console.error(err);

Check warning on line 138 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 138 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 138 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v22)

Unexpected console statement

Check warning on line 138 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 138 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 138 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v22)

Unexpected console statement
}
}
if (!Reporter) {
console.error(new Error(`invalid reporter "${reporterName}"`));

Check warning on line 142 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 142 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 142 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v22)

Unexpected console statement

Check warning on line 142 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 142 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 142 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v22)

Unexpected console statement
return;
}
this.#reporter = new Reporter(this, this.#mochaOptions);
Expand All @@ -165,7 +165,7 @@

#report(suite = this.#root) {
/* Not like mocha, node:test runs tests as soon as they are encountered
so the exact structure is unkown until all suites end */
so the exact structure is unknown until all suites end */
this.emit(EVENT_SUITE_BEGIN, suite);
suite.finalize();
for (const s of suite.suites) {
Expand Down
4 changes: 2 additions & 2 deletions packages/mocha/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const reporter = require('../index');

const snapshot = Snap(`${__filename}.${nodeMajor}`);

test('spwan with reporter', async () => {
test('spawn with reporter', async () => {
const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example'], { env: {} });
await snapshot(child);
});

test('spwan with reporter - esm', async () => {
test('spawn with reporter - esm', async () => {
const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example.mjs'], { env: {} });
await snapshot(child);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/silent/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const { Snap } = require('../../../tests/utils');

const snapshot = Snap(__filename);

test('spwan with reporter', async () => {
test('spawn with reporter', async () => {
const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example'], { env: {} });
await snapshot(child);
});

test('spwan with reporter - esm', async () => {
test('spawn with reporter - esm', async () => {
const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example.mjs'], { env: {} });
await snapshot(child);
});
2 changes: 1 addition & 1 deletion packages/slow/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { Snap } = require('../../../tests/utils');

const snapshot = Snap(__filename);

test('spwan with reporter', async () => {
test('spawn with reporter', async () => {
const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/slow_tests.js'], { env: { FORCE_COLOR: 1 } });
await snapshot(child);
});
2 changes: 1 addition & 1 deletion packages/testwatch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

### Bug Fixes

* increas maximum listeners of event emitters ([b16d2ab](https://github.com/MoLow/reporters/commit/b16d2ab3b55554e1aaa9b9ca2222254bac364803))
* increase maximum listeners of event emitters ([b16d2ab](https://github.com/MoLow/reporters/commit/b16d2ab3b55554e1aaa9b9ca2222254bac364803))
* support partial file name filter ([2b3f0ab](https://github.com/MoLow/reporters/commit/2b3f0abe0be37450c7b9189667ad47d4d39a4252))

## [1.1.0](https://github.com/MoLow/reporters/compare/testwatch-v1.0.0...testwatch-v1.1.0) (2023-06-08)
Expand Down
8 changes: 4 additions & 4 deletions packages/testwatch/assets/cli.gif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ records:
- delay: 25
content: " ▶ filters\r\n \e[32m✔ should filter tests on \"t\" \e[90m(701.858542ms)\e[39m\e[39m\r\n \e[32m✔ should filter files on \"p\" \e[90m(668.653625ms)\e[39m\e[39m\r\n"
- delay: 201
content: " \e[32m✔ should filter tests and files togetheer \e[90m(902.623166ms)\e[39m\e[39m\r\n \e[32m✔ should mention when no files found \e[90m(669.483333ms)\e[39m\e[39m\r\n"
content: " \e[32m✔ should filter tests and files together \e[90m(902.623166ms)\e[39m\e[39m\r\n \e[32m✔ should mention when no files found \e[90m(669.483333ms)\e[39m\e[39m\r\n"
- delay: 234
content: " \e[32m✔ should clear filters on \"c\" \e[90m(1136.047417ms)\e[39m\e[39m\r\n \e[32m✔ prompt ESC should preserve previous state \e[90m(1101.547958ms)\e[39m\e[39m\r\n \e[32m✔ backspace shoud remove last character \e[90m(627.751292ms)\e[39m\e[39m\r\n \e[32m▶ \e[39mfilters \e[90m(1138.54675ms)\e[39m\r\n\r\n\e[32m▶ \e[39mtestwatch \e[90m(1143.543416ms)\e[39m\r\n\r\n"
content: " \e[32m✔ should clear filters on \"c\" \e[90m(1136.047417ms)\e[39m\e[39m\r\n \e[32m✔ prompt ESC should preserve previous state \e[90m(1101.547958ms)\e[39m\e[39m\r\n \e[32m✔ backspace should remove last character \e[90m(627.751292ms)\e[39m\e[39m\r\n \e[32m▶ \e[39mfilters \e[90m(1138.54675ms)\e[39m\r\n\r\n\e[32m▶ \e[39mtestwatch \e[90m(1143.543416ms)\e[39m\r\n\r\n"
- delay: 6
content: "\e[32m✔ j - sum \e[90m(0.458875ms)\e[39m\e[39m\r\n\e[32m✔ j - subtraction \e[90m(0.160625ms)\e[39m\e[39m\r\n\e[32m✔ index - sum \e[90m(0.454875ms)\e[39m\e[39m\r\n\e[32m✔ index - subtraction \e[90m(0.128083ms)\e[39m\e[39m\r\n\r\n\e[1mREPL Usage\e[22m\r\n\e[90m › Press \e[37m\e[1ma\e[22m\e[39m\e[90m to run all tests.\e[39m\r\n\e[90m › Press \e[37m\e[1mp\e[22m\e[39m\e[90m to filter by a file name pattern.\e[39m\r\n\e[90m › Press \e[37m\e[1mt\e[22m\e[39m\e[90m to filter by a test name pattern.\e[39m\r\n\e[90m › Press \e[37m\e[1mq\e[22m\e[39m\e[90m to quit.\e[39m\r\n\e[90m › Press \e[37m\e[1mEnter\e[22m\e[39m\e[90m to trigger a test run.\e[39m\r\n"
- delay: 1523
Expand Down Expand Up @@ -176,9 +176,9 @@ records:
- delay: 40
content: " ▶ filters\r\n \e[32m✔ should filter tests on \"t\" \e[90m(691.810209ms)\e[39m\e[39m\r\n \e[32m✔ should filter files on \"p\" \e[90m(605.502625ms)\e[39m\e[39m\r\n"
- delay: 136
content: " \e[32m✔ should filter tests and files togetheer \e[90m(826.882875ms)\e[39m\e[39m\r\n \e[32m✔ should mention when no files found \e[90m(603.837791ms)\e[39m\e[39m\r\n"
content: " \e[32m✔ should filter tests and files together \e[90m(826.882875ms)\e[39m\e[39m\r\n \e[32m✔ should mention when no files found \e[90m(603.837791ms)\e[39m\e[39m\r\n"
- delay: 202
content: " \e[32m✔ should clear filters on \"c\" \e[90m(1026.169ms)\e[39m\e[39m\r\n \e[32m✔ prompt ESC should preserve previous state \e[90m(1003.537917ms)\e[39m\e[39m\r\n \e[32m✔ backspace shoud remove last character \e[90m(720.0275ms)\e[39m\e[39m\r\n \e[32m▶ \e[39mfilters \e[90m(1030.538708ms)\e[39m\r\n\r\n\e[32m▶ \e[39mtestwatch \e[90m(1035.127708ms)\e[39m\r\n\r\n\e[32m✔ j - sum \e[90m(0.452833ms)\e[39m\e[39m\r\n\e[32m✔ j - subtraction \e[90m(0.136416ms)\e[39m\e[39m\r\n\e[32m✔ index - sum \e[90m(0.457583ms)\e[39m\e[39m\r\n\e[32m✔ index - subtraction \e[90m(0.132541ms)\e[39m\e[39m\r\n\e[90m\e[39m\r\n\e[90m\e[37m\e[1mREPL Usage\e[22m\e[39m\e[90m: Press \e[37m\e[1mw\e[22m\e[39m\e[90m to show more.\e[39m"
content: " \e[32m✔ should clear filters on \"c\" \e[90m(1026.169ms)\e[39m\e[39m\r\n \e[32m✔ prompt ESC should preserve previous state \e[90m(1003.537917ms)\e[39m\e[39m\r\n \e[32m✔ backspace should remove last character \e[90m(720.0275ms)\e[39m\e[39m\r\n \e[32m▶ \e[39mfilters \e[90m(1030.538708ms)\e[39m\r\n\r\n\e[32m▶ \e[39mtestwatch \e[90m(1035.127708ms)\e[39m\r\n\r\n\e[32m✔ j - sum \e[90m(0.452833ms)\e[39m\e[39m\r\n\e[32m✔ j - subtraction \e[90m(0.136416ms)\e[39m\e[39m\r\n\e[32m✔ index - sum \e[90m(0.457583ms)\e[39m\e[39m\r\n\e[32m✔ index - subtraction \e[90m(0.132541ms)\e[39m\e[39m\r\n\e[90m\e[39m\r\n\e[90m\e[37m\e[1mREPL Usage\e[22m\e[39m\e[90m: Press \e[37m\e[1mw\e[22m\e[39m\e[90m to show more.\e[39m"
- delay: 1000
content: "\r\n\e[1A\e[2K\e[1A\e[2K\r\n\e[1mREPL Usage\e[22m\r\n\e[90m › Press \e[37m\e[1ma\e[22m\e[39m\e[90m to run all tests.\e[39m\r\n\e[90m › Press \e[37m\e[1mp\e[22m\e[39m\e[90m to filter by a file name pattern.\e[39m\r\n\e[90m › Press \e[37m\e[1mt\e[22m\e[39m\e[90m to filter by a test name pattern.\e[39m\r\n\e[90m › Press \e[37m\e[1mq\e[22m\e[39m\e[90m to quit.\e[39m\r\n\e[90m › Press \e[37m\e[1mEnter\e[22m\e[39m\e[90m to trigger a test run.\e[39m\r\n"
- delay: 1000
Expand Down
2 changes: 1 addition & 1 deletion packages/testwatch/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe('testwatch', { concurrency: true, skip: !isSupported ? 'unsupported nod
]);
});
});
it('should filter tests and files togetheer', async () => {
it('should filter tests and files together', async () => {
const { outputs, stderr } = await spawnInteractive(['p', 'index', '\r', 't', 'sum', '\r', 'w', 'q'].join(''));
const activeFilters = '\nActive Filters: file name **/index*.*, test name /sum/\n';
assert.strictEqual(stderr, '');
Expand Down
Loading