Skip to content

Commit 8176e44

Browse files
authored
feat: add a problem matcher for tap output (#160)
1 parent 5517e9e commit 8176e44

File tree

9 files changed

+151
-5
lines changed

9 files changed

+151
-5
lines changed

.github/matchers/tap.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.",
3+
"problemMatcher": [
4+
{
5+
"owner": "tap",
6+
"pattern": [
7+
{
8+
"regexp": "^\\s*not ok \\d+ - (.*)",
9+
"message": 1
10+
},
11+
{
12+
"regexp": "^\\s*---"
13+
},
14+
{
15+
"regexp": "^\\s*at:"
16+
},
17+
{
18+
"regexp": "^\\s*line:\\s*(\\d+)",
19+
"line": 1
20+
},
21+
{
22+
"regexp": "^\\s*column:\\s*(\\d+)",
23+
"column": 1
24+
},
25+
{
26+
"regexp": "^\\s*file:\\s*(.*)",
27+
"file": 1
28+
}
29+
]
30+
}
31+
]
32+
}

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,7 @@ jobs:
8282
if: ${{ !startsWith(matrix.node-version, '10.') }}
8383
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
8484
- run: npm -v
85+
- name: add tap problem matcher
86+
run: echo "::add-matcher::.github/matchers/tap.json"
8587
- run: npm i --ignore-scripts --no-audit --no-fund
8688
- run: npm test --ignore-scripts

lib/content/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,7 @@ jobs:
5555
steps:
5656
{{> setupGit}}
5757
{{> setupNode useMatrix=true}}
58+
- name: add tap problem matcher
59+
run: echo "::add-matcher::.github/matchers/tap.json"
5860
- run: npm i --ignore-scripts --no-audit --no-fund
5961
- run: npm test --ignore-scripts {{~#if isWorkspace}} -w {{pkgName}}{{/if}}

lib/content/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const rootRepo = {
99
'.github/ISSUE_TEMPLATE/config.yml': 'config.yml',
1010
'.github/CODEOWNERS': 'CODEOWNERS',
1111
'.github/dependabot.yml': 'dependabot.yml',
12+
'.github/matchers/tap.json': 'tap.json',
1213
'.github/workflows/audit.yml': 'audit.yml',
1314
'.github/workflows/codeql-analysis.yml': 'codeql-analysis.yml',
1415
'.github/workflows/post-dependabot.yml': 'post-dependabot.yml',

lib/content/tap.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"problemMatcher": [{
3+
"owner": "tap",
4+
"pattern" : [
5+
{
6+
"regexp": "^\\s*not ok \\d+ - (.*)",
7+
"message": 1
8+
},
9+
{
10+
"regexp": "^\\s*---"
11+
},
12+
{
13+
"regexp": "^\\s*at:"
14+
},
15+
{
16+
"regexp": "^\\s*line:\\s*(\\d+)",
17+
"line": 1
18+
},
19+
{
20+
"regexp": "^\\s*column:\\s*(\\d+)",
21+
"column": 1
22+
}, {
23+
"regexp": "^\\s*file:\\s*(.*)",
24+
"file": 1
25+
}
26+
]
27+
}]
28+
}

tap-snapshots/test/apply/full-content.js.test.cjs

+78
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,41 @@ updates:
128128
labels:
129129
- "Dependencies"
130130
131+
.github/matchers/tap.json
132+
========================================
133+
{
134+
"//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.",
135+
"problemMatcher": [
136+
{
137+
"owner": "tap",
138+
"pattern": [
139+
{
140+
"regexp": "^/s*not ok /d+ - (.*)",
141+
"message": 1
142+
},
143+
{
144+
"regexp": "^/s*---"
145+
},
146+
{
147+
"regexp": "^/s*at:"
148+
},
149+
{
150+
"regexp": "^/s*line:/s*(/d+)",
151+
"line": 1
152+
},
153+
{
154+
"regexp": "^/s*column:/s*(/d+)",
155+
"column": 1
156+
},
157+
{
158+
"regexp": "^/s*file:/s*(.*)",
159+
"file": 1
160+
}
161+
]
162+
}
163+
]
164+
}
165+
131166
.github/workflows/audit.yml
132167
========================================
133168
# This file is automatically added by @npmcli/template-oss. Do not edit.
@@ -244,6 +279,8 @@ jobs:
244279
if: \${{ !startsWith(matrix.node-version, '10.') }}
245280
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
246281
- run: npm -v
282+
- name: add tap problem matcher
283+
run: echo "::add-matcher::.github/matchers/tap.json"
247284
- run: npm i --ignore-scripts --no-audit --no-fund
248285
- run: npm test --ignore-scripts
249286
@@ -619,6 +656,41 @@ updates:
619656
labels:
620657
- "Dependencies"
621658
659+
.github/matchers/tap.json
660+
========================================
661+
{
662+
"//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.",
663+
"problemMatcher": [
664+
{
665+
"owner": "tap",
666+
"pattern": [
667+
{
668+
"regexp": "^/s*not ok /d+ - (.*)",
669+
"message": 1
670+
},
671+
{
672+
"regexp": "^/s*---"
673+
},
674+
{
675+
"regexp": "^/s*at:"
676+
},
677+
{
678+
"regexp": "^/s*line:/s*(/d+)",
679+
"line": 1
680+
},
681+
{
682+
"regexp": "^/s*column:/s*(/d+)",
683+
"column": 1
684+
},
685+
{
686+
"regexp": "^/s*file:/s*(.*)",
687+
"file": 1
688+
}
689+
]
690+
}
691+
]
692+
}
693+
622694
.github/workflows/audit.yml
623695
========================================
624696
# This file is automatically added by @npmcli/template-oss. Do not edit.
@@ -739,6 +811,8 @@ jobs:
739811
if: \${{ !startsWith(matrix.node-version, '10.') }}
740812
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
741813
- run: npm -v
814+
- name: add tap problem matcher
815+
run: echo "::add-matcher::.github/matchers/tap.json"
742816
- run: npm i --ignore-scripts --no-audit --no-fund
743817
- run: npm test --ignore-scripts -w bbb
744818
@@ -832,6 +906,8 @@ jobs:
832906
if: \${{ !startsWith(matrix.node-version, '10.') }}
833907
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
834908
- run: npm -v
909+
- name: add tap problem matcher
910+
run: echo "::add-matcher::.github/matchers/tap.json"
835911
- run: npm i --ignore-scripts --no-audit --no-fund
836912
- run: npm test --ignore-scripts -w @name/aaaa
837913
@@ -921,6 +997,8 @@ jobs:
921997
if: \${{ !startsWith(matrix.node-version, '10.') }}
922998
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
923999
- run: npm -v
1000+
- name: add tap problem matcher
1001+
run: echo "::add-matcher::.github/matchers/tap.json"
9241002
- run: npm i --ignore-scripts --no-audit --no-fund
9251003
- run: npm test --ignore-scripts
9261004

tap-snapshots/test/apply/index.js.test.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ exports[`test/apply/index.js TAP turn off module > expect resolving Promise 1`]
1515
.github/ISSUE_TEMPLATE/bug.yml
1616
.github/ISSUE_TEMPLATE/config.yml
1717
.github/dependabot.yml
18+
.github/matchers/tap.json
1819
.github/workflows/audit.yml
1920
.github/workflows/ci.yml
2021
.github/workflows/codeql-analysis.yml

tap-snapshots/test/check/diffs.js.test.cjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,11 @@ The repo file ci.yml needs to be updated:
310310
311311
.github/workflows/ci.yml
312312
========================================
313-
@@ -63,4 +63,24 @@
314-
git config --global user.name "npm CLI robot"
315-
- uses: actions/setup-node@v3
313+
@@ -65,4 +65,24 @@
316314
with:
317315
node-version: \${{ matrix.node-version }}
318-
+ - name: Update to workable npm (windows)
319-
+ # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
316+
- name: Update to workable npm (windows)
317+
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
320318
+ if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
321319
+ run: |
322320
+ curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
@@ -333,6 +331,8 @@ The repo file ci.yml needs to be updated:
333331
+ if: \${{ !startsWith(matrix.node-version, '10.') }}
334332
+ run: npm i --prefer-online --no-fund --no-audit -g npm@latest
335333
+ - run: npm -v
334+
+ - name: add tap problem matcher
335+
+ run: echo "::add-matcher::.github/matchers/tap.json"
336336
+ - run: npm i --ignore-scripts --no-audit --no-fund
337337
+ - run: npm test --ignore-scripts
338338

tap-snapshots/test/check/index.js.test.cjs

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The following repo files need to be added:
1818
.github/ISSUE_TEMPLATE/config.yml
1919
.github/CODEOWNERS
2020
.github/dependabot.yml
21+
.github/matchers/tap.json
2122
.github/workflows/audit.yml
2223
.github/workflows/codeql-analysis.yml
2324
.github/workflows/post-dependabot.yml
@@ -97,6 +98,7 @@ The following repo files need to be added:
9798
.github/ISSUE_TEMPLATE/config.yml
9899
.github/CODEOWNERS
99100
.github/dependabot.yml
101+
.github/matchers/tap.json
100102
.github/workflows/audit.yml
101103
.github/workflows/codeql-analysis.yml
102104
.github/workflows/post-dependabot.yml

0 commit comments

Comments
 (0)