| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b40b01b commit 697e799
12 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -105,4 +105,4 @@ jobs: | |||
| 105 | 105 | - name: Test | |
| 106 | 106 | run: | | |
| 107 | 107 | cd $TAR_DIR | |
| 108 | - make run-ci -j4 V=1 TEST_CI_ARGS="-p dots --node-args='--test-reporter=spec' --measure-flakiness 9" | ||
| 108 | + make run-ci -j4 V=1 TEST_CI_ARGS="-p dots --node-args='--test-reporter=./test/common/test-error-reporter.js' --measure-flakiness 9" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,7 +68,7 @@ jobs: | |||
| 68 | 68 | # TODO(bcoe): fix the couple tests that fail with the inspector enabled. | |
| 69 | 69 | # The cause is most likely coverage's use of the inspector. | |
| 70 | 70 | - name: Test | |
| 71 | - run: NODE_V8_COVERAGE=coverage/tmp make test-cov -j4 V=1 TEST_CI_ARGS="-p dots --node-args='--test-reporter=spec' --measure-flakiness 9" || exit 0 | ||
| 71 | + run: NODE_V8_COVERAGE=coverage/tmp make test-cov -j4 V=1 TEST_CI_ARGS="-p dots --node-args='--test-reporter=./test/common/test-error-reporter.js' --measure-flakiness 9" || exit 0 | ||
| 72 | 72 | - name: Report JS | |
| 73 | 73 | run: npx c8 report --check-coverage | |
| 74 | 74 | env: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,7 +68,7 @@ jobs: | |||
| 68 | 68 | # TODO(bcoe): fix the couple tests that fail with the inspector enabled. | |
| 69 | 69 | # The cause is most likely coverage's use of the inspector. | |
| 70 | 70 | - name: Test | |
| 71 | - run: NODE_V8_COVERAGE=coverage/tmp make test-cov -j4 V=1 TEST_CI_ARGS="-p dots --node-args='--test-reporter=spec' --measure-flakiness 9" || exit 0 | ||
| 71 | + run: NODE_V8_COVERAGE=coverage/tmp make test-cov -j4 V=1 TEST_CI_ARGS="-p dots --node-args='--test-reporter=./test/common/test-error-reporter.js' --measure-flakiness 9" || exit 0 | ||
| 72 | 72 | - name: Report JS | |
| 73 | 73 | run: npx c8 report --check-coverage | |
| 74 | 74 | env: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,4 +40,4 @@ jobs: | |||
| 40 | 40 | name: docs | |
| 41 | 41 | path: out/doc | |
| 42 | 42 | - name: Test | |
| 43 | - run: NODE=$(command -v node) make test-doc-ci TEST_CI_ARGS="-p actions --node-args='--test-reporter=spec' --node-args='--test-reporter-destination=stdout' --measure-flakiness 9" | ||
| 43 | + run: NODE=$(command -v node) make test-doc-ci TEST_CI_ARGS="-p actions --node-args='--test-reporter=./test/common/test-error-reporter.js' --node-args='--test-reporter-destination=stdout' --measure-flakiness 9" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,4 +63,4 @@ jobs: | |||
| 63 | 63 | - name: Build | |
| 64 | 64 | run: make build-ci -j4 V=1 | |
| 65 | 65 | - name: Test | |
| 66 | - run: make run-ci -j4 V=1 TEST_CI_ARGS="-p actions --node-args='--test-reporter=spec' --node-args='--test-reporter-destination=stdout' -t 300 --measure-flakiness 9" | ||
| 66 | + run: make run-ci -j4 V=1 TEST_CI_ARGS="-p actions --node-args='--test-reporter=./test/common/test-error-reporter.js' --node-args='--test-reporter-destination=stdout' -t 300 --measure-flakiness 9" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,7 +54,7 @@ jobs: | |||
| 54 | 54 | - name: Build | |
| 55 | 55 | run: make -C node build-ci -j4 V=1 CONFIG_FLAGS="--error-on-warn" | |
| 56 | 56 | - name: Test | |
| 57 | - run: make -C node run-ci -j4 V=1 TEST_CI_ARGS="-p actions --node-args='--test-reporter=spec' --node-args='--test-reporter-destination=stdout' --measure-flakiness 9" | ||
| 57 | + run: make -C node run-ci -j4 V=1 TEST_CI_ARGS="-p actions --node-args='--test-reporter=./test/common/test-error-reporter.js' --node-args='--test-reporter-destination=stdout' --measure-flakiness 9" | ||
| 58 | 58 | - name: Re-run test in a folder whose name contains unusual chars | |
| 59 | 59 | run: | | |
| 60 | 60 | mv node "$DIR" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,7 +89,7 @@ jobs: | |||
| 89 | 89 | - name: Free Space After Build | |
| 90 | 90 | run: df -h | |
| 91 | 91 | - name: Test | |
| 92 | - run: make -C node run-ci -j$(getconf _NPROCESSORS_ONLN) V=1 TEST_CI_ARGS="-p actions --node-args='--test-reporter=spec' --node-args='--test-reporter-destination=stdout' --measure-flakiness 9" | ||
| 92 | + run: make -C node run-ci -j$(getconf _NPROCESSORS_ONLN) V=1 TEST_CI_ARGS="-p actions --node-args='--test-reporter=./test/common/test-error-reporter.js' --node-args='--test-reporter-destination=stdout' --measure-flakiness 9" | ||
| 93 | 93 | - name: Re-run test in a folder whose name contains unusual chars | |
| 94 | 94 | run: | | |
| 95 | 95 | mv node "$DIR" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,4 +64,4 @@ jobs: | |||
| 64 | 64 | - name: Build | |
| 65 | 65 | run: make build-ci -j2 V=1 | |
| 66 | 66 | - name: Test | |
| 67 | - run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions --node-args='--test-reporter=spec' --node-args='--test-reporter-destination=stdout' -t 300 --measure-flakiness 9" | ||
| 67 | + run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions --node-args='--test-reporter=./test/common/test-error-reporter.js' --node-args='--test-reporter-destination=stdout' -t 300 --measure-flakiness 9" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,41 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const { relative } = require('node:path'); | ||
| 3 | + const { inspect } = require('node:util'); | ||
| 4 | + const cwd = process.cwd(); | ||
| 5 | + | ||
| 6 | + module.exports = async function* errorReporter(source) { | ||
| 7 | + for await (const event of source) { | ||
| 8 | + if (event.type === 'test:fail') { | ||
| 9 | + const { name, details, line, column, file } = event.data; | ||
| 10 | + let { error } = details; | ||
| 11 | + | ||
| 12 | + if (error?.failureType === 'subtestsFailed') { | ||
| 13 | + // In the interest of keeping things concise, skip failures that are | ||
| 14 | + // only due to nested failures. | ||
| 15 | + continue; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + if (error?.code === 'ERR_TEST_FAILURE') { | ||
| 19 | + error = error.cause; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + const output = [ | ||
| 23 | + `Test failure: '${name}'`, | ||
| 24 | + ]; | ||
| 25 | + | ||
| 26 | + if (file) { | ||
| 27 | + output.push(`Location: ${relative(cwd, file)}:${line}:${column}`); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + output.push(inspect(error)); | ||
| 31 | + output.push('\n'); | ||
| 32 | + yield output.join('\n'); | ||
| 33 | + | ||
| 34 | + if (process.env.FAIL_FAST) { | ||
| 35 | + yield `\nBailing on failed test: ${event.data.name}\n`; | ||
| 36 | + process.exitCode = 1; | ||
| 37 | + process.emit('SIGINT'); | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,6 @@ | |||
| 1 | + const assert = require('node:assert'); | ||
| 2 | + const { test } = require('node:test'); | ||
| 3 | + | ||
| 4 | + test('fail', () => { | ||
| 5 | + assert.fail('a.mjs fail'); | ||
| 6 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments