Merge pull request #2131 from MeilCli/dependabot/npm_and_yarn/cross-f… #4434
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
operator-add: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./testing/create | |
- uses: ./operator/add | |
with: | |
function: | | |
() => add({path: "test/path3.txt", rule: "test-rule-ext", message: "hello", level: "notice"}) | |
- uses: ./testing/expect | |
with: | |
expect_data_json: | | |
[ | |
{ | |
"path": "test/path1.txt", | |
"rule": "test-rule1", | |
"message": "test message", | |
"level": "notice" | |
}, | |
{ | |
"path": "test/path1.txt", | |
"rule": "test-rule2", | |
"message": "test message", | |
"level": "warning", | |
"startLine": 1, | |
"startColumn": 10, | |
"endLine": 1, | |
"endColumn": 15 | |
}, | |
{ | |
"path": "test/path2.txt", | |
"rule": "test-rule2", | |
"message": "test message", | |
"level": "failure", | |
"startLine": 1, | |
"startColumn": 10, | |
"endLine": 1, | |
"endColumn": 15 | |
}, | |
{ | |
"path": "test/path3.txt", | |
"rule": "test-rule-ext", | |
"message": "hello", | |
"level": "notice" | |
} | |
] | |
operator-filter: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./testing/create | |
- uses: ./operator/filter | |
with: | |
function: | | |
(x) => x.path != "test/path1.txt" | |
- uses: ./testing/expect | |
with: | |
expect_data_json: | | |
[ | |
{ | |
"path": "test/path2.txt", | |
"rule": "test-rule2", | |
"message": "test message", | |
"level": "failure", | |
"startLine": 1, | |
"startColumn": 10, | |
"endLine": 1, | |
"endColumn": 15 | |
} | |
] | |
operator-distinct: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./testing/create | |
- uses: ./operator/distinct | |
with: | |
function: | | |
(x) => x.path | |
- uses: ./testing/expect | |
with: | |
expect_data_json: | | |
[ | |
{ | |
"path": "test/path1.txt", | |
"rule": "test-rule1", | |
"message": "test message", | |
"level": "notice" | |
}, | |
{ | |
"path": "test/path2.txt", | |
"rule": "test-rule2", | |
"message": "test message", | |
"level": "failure", | |
"startLine": 1, | |
"startColumn": 10, | |
"endLine": 1, | |
"endColumn": 15 | |
} | |
] | |
operator-map: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./testing/create | |
- uses: ./operator/map | |
with: | |
function: | | |
(x) => Object.assign(x, {message: "message: " + x.message}) | |
- uses: ./testing/expect | |
with: | |
expect_data_json: | | |
[ | |
{ | |
"path": "test/path1.txt", | |
"rule": "test-rule1", | |
"message": "message: test message", | |
"level": "notice" | |
}, | |
{ | |
"path": "test/path1.txt", | |
"rule": "test-rule2", | |
"message": "message: test message", | |
"level": "warning", | |
"startLine": 1, | |
"startColumn": 10, | |
"endLine": 1, | |
"endColumn": 15 | |
}, | |
{ | |
"path": "test/path2.txt", | |
"rule": "test-rule2", | |
"message": "message: test message", | |
"level": "failure", | |
"startLine": 1, | |
"startColumn": 10, | |
"endLine": 1, | |
"endColumn": 15 | |
} | |
] |