@zazuko/shacl-test 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yaml +9 -11
- package/CHANGELOG.md +13 -0
- package/README.md +4 -2
- package/package.json +14 -10
- package/run.sh +21 -2
|
@@ -7,24 +7,25 @@ on:
|
|
|
7
7
|
|
|
8
8
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
9
9
|
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write
|
|
12
|
+
contents: write
|
|
13
|
+
pull-requests: write
|
|
14
|
+
|
|
10
15
|
jobs:
|
|
11
16
|
release:
|
|
12
17
|
name: Release
|
|
13
18
|
runs-on: ubuntu-latest
|
|
14
19
|
|
|
15
|
-
permissions:
|
|
16
|
-
contents: write
|
|
17
|
-
pull-requests: write
|
|
18
|
-
|
|
19
20
|
steps:
|
|
20
21
|
- name: Checkout Repo
|
|
21
|
-
uses: actions/checkout@
|
|
22
|
+
uses: actions/checkout@v7
|
|
22
23
|
with:
|
|
23
24
|
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
|
|
24
25
|
fetch-depth: 0
|
|
25
26
|
|
|
26
27
|
- name: Setup Node.js
|
|
27
|
-
uses: actions/setup-node@
|
|
28
|
+
uses: actions/setup-node@v7
|
|
28
29
|
with:
|
|
29
30
|
node-version: "lts/*"
|
|
30
31
|
|
|
@@ -33,10 +34,7 @@ jobs:
|
|
|
33
34
|
|
|
34
35
|
- name: Create Release Pull Request or Publish to npm
|
|
35
36
|
id: changesets
|
|
36
|
-
uses: changesets/action@
|
|
37
|
+
uses: changesets/action@v2
|
|
37
38
|
with:
|
|
38
39
|
# This expects you to have a script called release which does a build for your packages and calls changeset publish
|
|
39
|
-
publish:
|
|
40
|
-
env:
|
|
41
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
42
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
40
|
+
publish-script: npm run release
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @zazuko/shacl-test
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f09b688: Provide test run summary and exit with nonzero code when no tests are found
|
|
8
|
+
- 87bd0b0: Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 0.1.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 0a192ef: Make `--filter` case-insensitive
|
|
15
|
+
|
|
3
16
|
## 0.1.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Runs SHACL shapes against a set of positive and negative test cases (data graphs
|
|
|
4
4
|
|
|
5
5
|
Positive test cases are a simple fail/pass.
|
|
6
6
|
Negative test cases are expected to fail and the validation report is compared against the
|
|
7
|
-
expectation using [approvals](https://npm.im/approvals).
|
|
7
|
+
expectation using [approvals](https://npm.im/@approval-tests/approvals).
|
|
8
8
|
|
|
9
9
|
In case of failures, a [SHACL Playground](https://shacl-playground.zazuko.com)
|
|
10
10
|
link is provided for further investigation.
|
|
@@ -23,7 +23,9 @@ npx shacl-test \
|
|
|
23
23
|
--command="${COMMAND}"
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
The `--shapes` option is required.
|
|
27
|
+
Also, you must provide at least `--valid-cases` or `--invalid-cases`, lest no tests are run.
|
|
28
|
+
The rest are optional.
|
|
27
29
|
|
|
28
30
|
`--shapes` can be a filesystem path or URL and include [`code:imports`](https://github.com/zazuko/rdf-transform-graph-imports).
|
|
29
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zazuko/shacl-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"shacl-test": "./run.sh"
|
|
@@ -17,16 +17,20 @@
|
|
|
17
17
|
"author": "Zazuko GmbH",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
22
|
-
"@zazuko/
|
|
23
|
-
"@zazuko/
|
|
24
|
-
"
|
|
25
|
-
"barnard59-rdf": "^
|
|
26
|
-
"barnard59-shacl": "^
|
|
27
|
-
"rdf-transform-graph-imports": "^0.2.
|
|
20
|
+
"@approval-tests/approvals": "^7.6.0",
|
|
21
|
+
"@rdfjs-elements/formats-pretty": "^0.6.9",
|
|
22
|
+
"@zazuko/env-node": "^3",
|
|
23
|
+
"@zazuko/s": "^2.0.0",
|
|
24
|
+
"@zazuko/shacl-playground": "^3.0.1",
|
|
25
|
+
"barnard59-rdf": "^4.0.1",
|
|
26
|
+
"barnard59-shacl": "^2.0.1",
|
|
27
|
+
"rdf-transform-graph-imports": "^0.2.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@changesets/cli": "^
|
|
30
|
+
"@changesets/cli": "^3"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/zazuko/shacl-test"
|
|
31
35
|
}
|
|
32
36
|
}
|
package/run.sh
CHANGED
|
@@ -66,13 +66,17 @@ loadFullShape() {
|
|
|
66
66
|
"$SCRIPT_PATH"/load-graph.js "$1" | "$SCRIPT_PATH"/pretty-print.js --prefixes "${prefixes[@]}"
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
testsRun=0
|
|
70
|
+
|
|
69
71
|
# iterate over valid cases, run validation and monitor exit code
|
|
70
72
|
for file in $validCases; do
|
|
73
|
+
testsRun=$((testsRun + 1))
|
|
74
|
+
|
|
71
75
|
name=$(basename "$file")
|
|
72
76
|
relativePath=$(node -e "console.log(require('path').relative('$WORKING_DIR', '$file'))")
|
|
73
77
|
|
|
74
78
|
# check if filter is set and skip if not matching
|
|
75
|
-
if [ -n "$filter" ] && ! echo "$file" | grep -
|
|
79
|
+
if [ -n "$filter" ] && ! echo "$file" | grep -iq "$filter"; then
|
|
76
80
|
echo "ℹ️SKIP - $relativePath"
|
|
77
81
|
continue
|
|
78
82
|
fi
|
|
@@ -92,6 +96,8 @@ done
|
|
|
92
96
|
|
|
93
97
|
# iterate over invalid cases
|
|
94
98
|
for file in $invalidCases; do
|
|
99
|
+
testsRun=$((testsRun + 1))
|
|
100
|
+
|
|
95
101
|
name=$(basename "$file")
|
|
96
102
|
relativePath=$(node -e "console.log(require('path').relative('$WORKING_DIR', '$file'))")
|
|
97
103
|
|
|
@@ -101,7 +107,7 @@ for file in $invalidCases; do
|
|
|
101
107
|
fi
|
|
102
108
|
|
|
103
109
|
# check if pattern is set and skip if not matching
|
|
104
|
-
if [ -n "$filter" ] && ! echo "$file" | grep -
|
|
110
|
+
if [ -n "$filter" ] && ! echo "$file" | grep -iq "$filter"; then
|
|
105
111
|
echo "ℹ️SKIP - $relativePath"
|
|
106
112
|
continue
|
|
107
113
|
fi
|
|
@@ -116,4 +122,17 @@ for file in $invalidCases; do
|
|
|
116
122
|
fi
|
|
117
123
|
done
|
|
118
124
|
|
|
125
|
+
if [ $testsRun -eq 0 ]; then
|
|
126
|
+
echo "ℹ️ No test cases found"
|
|
127
|
+
echo "ℹ️ Check if the --valid-cases and --invalid-cases globs match any files"
|
|
128
|
+
exit 255
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
echo "🏁 Tests cases run: $testsRun"
|
|
132
|
+
if [ $FAILED -eq 0 ]; then
|
|
133
|
+
echo "🎉 All tests passed"
|
|
134
|
+
else
|
|
135
|
+
echo "❌ Failed $FAILED tests"
|
|
136
|
+
fi
|
|
137
|
+
|
|
119
138
|
exit $FAILED
|