Skip to content

Commit

Permalink
feat: add a problem matcher for tap output (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf committed Aug 16, 2022
1 parent 5517e9e commit 8176e44
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 5 deletions.
32 changes: 32 additions & 0 deletions .github/matchers/tap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.",
"problemMatcher": [
{
"owner": "tap",
"pattern": [
{
"regexp": "^\\s*not ok \\d+ - (.*)",
"message": 1
},
{
"regexp": "^\\s*---"
},
{
"regexp": "^\\s*at:"
},
{
"regexp": "^\\s*line:\\s*(\\d+)",
"line": 1
},
{
"regexp": "^\\s*column:\\s*(\\d+)",
"column": 1
},
{
"regexp": "^\\s*file:\\s*(.*)",
"file": 1
}
]
}
]
}
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts
2 changes: 2 additions & 0 deletions lib/content/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@ jobs:
steps:
{{> setupGit}}
{{> setupNode useMatrix=true}}
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
1 change: 1 addition & 0 deletions lib/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const rootRepo = {
'.github/ISSUE_TEMPLATE/config.yml': 'config.yml',
'.github/CODEOWNERS': 'CODEOWNERS',
'.github/dependabot.yml': 'dependabot.yml',
'.github/matchers/tap.json': 'tap.json',
'.github/workflows/audit.yml': 'audit.yml',
'.github/workflows/codeql-analysis.yml': 'codeql-analysis.yml',
'.github/workflows/post-dependabot.yml': 'post-dependabot.yml',
Expand Down
28 changes: 28 additions & 0 deletions lib/content/tap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"problemMatcher": [{
"owner": "tap",
"pattern" : [
{
"regexp": "^\\s*not ok \\d+ - (.*)",
"message": 1
},
{
"regexp": "^\\s*---"
},
{
"regexp": "^\\s*at:"
},
{
"regexp": "^\\s*line:\\s*(\\d+)",
"line": 1
},
{
"regexp": "^\\s*column:\\s*(\\d+)",
"column": 1
}, {
"regexp": "^\\s*file:\\s*(.*)",
"file": 1
}
]
}]
}
78 changes: 78 additions & 0 deletions tap-snapshots/test/apply/full-content.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,41 @@ updates:
labels:
- "Dependencies"
.github/matchers/tap.json
========================================
{
"//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.",
"problemMatcher": [
{
"owner": "tap",
"pattern": [
{
"regexp": "^/s*not ok /d+ - (.*)",
"message": 1
},
{
"regexp": "^/s*---"
},
{
"regexp": "^/s*at:"
},
{
"regexp": "^/s*line:/s*(/d+)",
"line": 1
},
{
"regexp": "^/s*column:/s*(/d+)",
"column": 1
},
{
"regexp": "^/s*file:/s*(.*)",
"file": 1
}
]
}
]
}
.github/workflows/audit.yml
========================================
# This file is automatically added by @npmcli/template-oss. Do not edit.
Expand Down Expand Up @@ -244,6 +279,8 @@ jobs:
if: \${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts
Expand Down Expand Up @@ -619,6 +656,41 @@ updates:
labels:
- "Dependencies"
.github/matchers/tap.json
========================================
{
"//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.",
"problemMatcher": [
{
"owner": "tap",
"pattern": [
{
"regexp": "^/s*not ok /d+ - (.*)",
"message": 1
},
{
"regexp": "^/s*---"
},
{
"regexp": "^/s*at:"
},
{
"regexp": "^/s*line:/s*(/d+)",
"line": 1
},
{
"regexp": "^/s*column:/s*(/d+)",
"column": 1
},
{
"regexp": "^/s*file:/s*(.*)",
"file": 1
}
]
}
]
}
.github/workflows/audit.yml
========================================
# This file is automatically added by @npmcli/template-oss. Do not edit.
Expand Down Expand Up @@ -739,6 +811,8 @@ jobs:
if: \${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w bbb
Expand Down Expand Up @@ -832,6 +906,8 @@ jobs:
if: \${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w @name/aaaa
Expand Down Expand Up @@ -921,6 +997,8 @@ jobs:
if: \${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts
Expand Down
1 change: 1 addition & 0 deletions tap-snapshots/test/apply/index.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ exports[`test/apply/index.js TAP turn off module > expect resolving Promise 1`]
.github/ISSUE_TEMPLATE/bug.yml
.github/ISSUE_TEMPLATE/config.yml
.github/dependabot.yml
.github/matchers/tap.json
.github/workflows/audit.yml
.github/workflows/ci.yml
.github/workflows/codeql-analysis.yml
Expand Down
10 changes: 5 additions & 5 deletions tap-snapshots/test/check/diffs.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,11 @@ The repo file ci.yml needs to be updated:
.github/workflows/ci.yml
========================================
@@ -63,4 +63,24 @@
git config --global user.name "npm CLI robot"
- uses: actions/setup-node@v3
@@ -65,4 +65,24 @@
with:
node-version: \${{ matrix.node-version }}
+ - name: Update to workable npm (windows)
+ # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
+ if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
+ run: |
+ curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
Expand All @@ -333,6 +331,8 @@ The repo file ci.yml needs to be updated:
+ if: \${{ !startsWith(matrix.node-version, '10.') }}
+ run: npm i --prefer-online --no-fund --no-audit -g npm@latest
+ - run: npm -v
+ - name: add tap problem matcher
+ run: echo "::add-matcher::.github/matchers/tap.json"
+ - run: npm i --ignore-scripts --no-audit --no-fund
+ - run: npm test --ignore-scripts
Expand Down
2 changes: 2 additions & 0 deletions tap-snapshots/test/check/index.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The following repo files need to be added:
.github/ISSUE_TEMPLATE/config.yml
.github/CODEOWNERS
.github/dependabot.yml
.github/matchers/tap.json
.github/workflows/audit.yml
.github/workflows/codeql-analysis.yml
.github/workflows/post-dependabot.yml
Expand Down Expand Up @@ -97,6 +98,7 @@ The following repo files need to be added:
.github/ISSUE_TEMPLATE/config.yml
.github/CODEOWNERS
.github/dependabot.yml
.github/matchers/tap.json
.github/workflows/audit.yml
.github/workflows/codeql-analysis.yml
.github/workflows/post-dependabot.yml
Expand Down

0 comments on commit 8176e44

Please sign in to comment.