Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test_runner: CR - fix lint error & cleaner UT
  • Loading branch information
atlowChemi committed Mar 24, 2023
commit 0e16ae4416dec767b610b980bbec697e9820b360
1 change: 1 addition & 0 deletions doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,7 @@ added:

```mjs
import { tap } from 'node:test/reporters';
Comment thread
aduh95 marked this conversation as resolved.
import process from 'node:process';

run({ files: [path.resolve('./tests/test.js')] })
.compose(tap)
Expand Down
22 changes: 6 additions & 16 deletions test/parallel/test-runner-run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,11 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
}));
});

it('should be piped with dot', (ctx, done) => {
const written = [];
const writer = new Writable();
writer._write = function(chunk, encoding, cb) {
written.push(chunk.toString());
process.nextTick(cb);
};
function finish() {
assert.deepStrictEqual(written, [
'.',
'\n',
]);
done();
}
writer.on('finish', finish);
run({ files: [join(testFixtures, 'test/random.cjs')] }).compose(dot).pipe(writer);
it('should be piped with dot', async () => {
const result = await run({ files: [join(testFixtures, 'test/random.cjs')] }).compose(dot).toArray();
assert.deepStrictEqual(result, [
'.',
'\n',
]);
});
});