Skip to content

Commit 432dc3e

Browse files
committed
fix: add test for invalid package-support.json
Signed-off-by: Michael Dawson <[email protected]>
1 parent d11a42e commit 432dc3e

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

lib/cli/commands/validate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ module.exports = function (opts) {
5757
return
5858
}
5959
} catch (e) {
60-
argv.log.info('validate: ', e.prettyValidationErrors)
60+
console.log('Error in support JSON')
61+
console.log(e.prettyValidationErrors)
6162
}
6263
} else {
6364
argv.log.info('support info not resolved: ' + supportData.url)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
validate
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Error in support JSON
2+
TYPE should be array
3+
4+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"Xbest-effort"},"backing":{"hobby":"https://github.com/pkgjs/support"}}]}
5+
| ^^^^^^^^^^^^^^^^^^^^^^^ 👈🏽 type should be array
6+
7+
ONEOF should match exactly one schema in oneOf
8+
9+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"Xbest-effort"},"backing":{"hobby":"https://github.com/pkgjs/support"}}]}
10+
| ^^^^^^^^^^^^^^^^^^^^^^^ 👈🏽 oneOf should match exactly one schema in oneOf
11+
12+
ENUM should be equal to one of the allowed values
13+
14+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"Xbest-effort"},"backing":{"hobby":"https://github.com/pkgjs/support"}}]}
15+
| ^^^^^^^^^^^^^^ 👈🏽 enum should be equal to one of the allowed values
16+
17+
PATTERN should match pattern "regular-[1-7]"
18+
19+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"Xbest-effort"},"backing":{"hobby":"https://github.com/pkgjs/support"}}]}
20+
| ^^^^^^^^^^^^^^ 👈🏽 pattern should match pattern "regular-[1-7]"
21+
22+
ONEOF should match exactly one schema in oneOf
23+
24+
> 1 | {"versions":[{"version":"*","target":{"node":"supported"},"response":{"type":"Xbest-effort"},"backing":{"hobby":"https://github.com/pkgjs/support"}}]}
25+
| ^^^^^^^^^^^^^^ 👈🏽 oneOf should match exactly one schema in oneOf
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"versions": [
3+
{
4+
"version": "*",
5+
"target": {
6+
"node": "supported"
7+
},
8+
"response": {
9+
"type": "Xbest-effort"
10+
},
11+
"backing": {
12+
"hobby": "https://github.com/pkgjs/support"
13+
}
14+
}
15+
]
16+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@pkgjs/support-show-local",
3+
"version": "0.0.1",
4+
"support": true,
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/pkgjs/support.git"
8+
}
9+
}

0 commit comments

Comments
 (0)