Skip to content

Commit 0d49eda

Browse files
authoredJul 30, 2022
fix: parse ci failure error (#640)
1 parent bbad9a0 commit 0d49eda

File tree

4 files changed

+25050
-1
lines changed

4 files changed

+25050
-1
lines changed
 

‎lib/ci/ci_failure_parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ const FAILURE_FILTERS = [{
155155
}, {
156156
// TODO: match indentation to avoid skipping context with '...'
157157
filter(ctx, text) {
158-
const pattern = /not ok \d+[\s\S]+? {2}\.\.\.\r?\n/mg;
158+
const pattern = /^not ok \d+[\s\S]+? {2}\.\.\.\r?\n/mg;
159159
const matches = text.match(pattern);
160160
if (!matches) {
161161
return null;

‎test/fixtures/jenkins/test-runner-test-failure/console.txt

+25,026
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[{
2+
"builtOn": "test-nearform-macos11.0-arm64-1",
3+
"file": "message/test_runner_desctibe_it",
4+
"highlight": 0,
5+
"reason": "not ok 3283 message/test_runner_desctibe_it\n ---\n duration_ms: 5.114\n severity: fail\n exitcode: 1\n stack: |-\n TAP version 13\n # Subtest: sync pass todo\n ok 1 - sync pass todo # TODO\n ---\n duration_ms: 0.001743083\n ...\n",
6+
"severity": "fail",
7+
"type": "JS_TEST_FAILURE",
8+
"url": "https://ci.nodejs.org/job/node-test-commit-osx-arm/nodes=osx11/6298/"
9+
}]

‎test/unit/ci_failure_parser.test.js

+14
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,18 @@ describe('Jenkins', () => {
1818
fixtures.readJSON('jenkins', 'git-failure-2', 'expected.json');
1919
assert.deepStrictEqual(raw(actual), expected);
2020
});
21+
22+
// Test for issue https://github.com/nodejs/node-core-utils/issues/639
23+
it('should parse test failure of test runner', async() => {
24+
const text =
25+
fixtures.readFile('jenkins', 'test-runner-test-failure', 'console.txt');
26+
const parser = new CIFailureParser({
27+
jobUrl: 'https://ci.nodejs.org/job/node-test-commit-osx-arm/nodes=osx11/6298/',
28+
builtOn: 'test-nearform-macos11.0-arm64-1'
29+
}, text);
30+
const actual = parser.parse();
31+
const expected =
32+
fixtures.readJSON('jenkins', 'test-runner-test-failure', 'expected.json');
33+
assert.deepStrictEqual(raw(actual), expected);
34+
});
2135
});

0 commit comments

Comments
 (0)
Please sign in to comment.