| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | - const { ObjectDefineProperties } = primordials; | ||
| 3 | + const { ObjectDefineProperties, ReflectConstruct } = primordials; | ||
| 4 | 4 | ||
| 5 | 5 | let dot; | |
| 6 | 6 | let spec; | |
@@ -21,9 +21,9 @@ ObjectDefineProperties(module.exports, { | |||
| 21 | 21 | __proto__: null, | |
| 22 | 22 | configurable: true, | |
| 23 | 23 | enumerable: true, | |
| 24 | - get() { | ||
| 24 | + value: function value() { | ||
| 25 | 25 | spec ??= require('internal/test_runner/reporter/spec'); | |
| 26 | - return spec; | ||
| 26 | + return ReflectConstruct(spec, arguments); | ||
| 27 | 27 | }, | |
| 28 | 28 | }, | |
| 29 | 29 | tap: { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,15 +82,28 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { | |||
| 82 | 82 | ]); | |
| 83 | 83 | }); | |
| 84 | 84 | ||
| 85 | - it('should be piped with spec', async () => { | ||
| 86 | - const specReporter = new spec(); | ||
| 87 | - const result = await run({ | ||
| 88 | - files: [join(testFixtures, 'default-behavior/test/random.cjs')] | ||
| 89 | - }).compose(specReporter).toArray(); | ||
| 90 | - const stringResults = result.map((bfr) => bfr.toString()); | ||
| 91 | - assert.match(stringResults[0], /this should pass/); | ||
| 92 | - assert.match(stringResults[1], /tests 1/); | ||
| 93 | - assert.match(stringResults[1], /pass 1/); | ||
| 85 | + describe('should be piped with spec reporter', () => { | ||
| 86 | + it('new spec', async () => { | ||
| 87 | + const specReporter = new spec(); | ||
| 88 | + const result = await run({ | ||
| 89 | + files: [join(testFixtures, 'default-behavior/test/random.cjs')] | ||
| 90 | + }).compose(specReporter).toArray(); | ||
| 91 | + const stringResults = result.map((bfr) => bfr.toString()); | ||
| 92 | + assert.match(stringResults[0], /this should pass/); | ||
| 93 | + assert.match(stringResults[1], /tests 1/); | ||
| 94 | + assert.match(stringResults[1], /pass 1/); | ||
| 95 | + }); | ||
| 96 | + | ||
| 97 | + it('spec()', async () => { | ||
| 98 | + const specReporter = spec(); | ||
| 99 | + const result = await run({ | ||
| 100 | + files: [join(testFixtures, 'default-behavior/test/random.cjs')] | ||
| 101 | + }).compose(specReporter).toArray(); | ||
| 102 | + const stringResults = result.map((bfr) => bfr.toString()); | ||
| 103 | + assert.match(stringResults[0], /this should pass/); | ||
| 104 | + assert.match(stringResults[1], /tests 1/); | ||
| 105 | + assert.match(stringResults[1], /pass 1/); | ||
| 106 | + }); | ||
| 94 | 107 | }); | |
| 95 | 108 | ||
| 96 | 109 | it('should be piped with tap', async () => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments