File tree 2 files changed +52
-0
lines changed
2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Validate annotation tests
2
+
3
+ on :
4
+ pull_request :
5
+ paths :
6
+ - " annotations/**"
7
+
8
+ jobs :
9
+ annotate :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - uses : actions/checkout@v4
14
+
15
+ - name : Set up Deno
16
+ uses : denoland/setup-deno@v2
17
+ with :
18
+ deno-version : " 2.x"
19
+
20
+ - name : Validate annotation tests
21
+ run : deno --node-modules-dir=auto --allow-read --no-prompt bin/annotation-tests.ts
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env deno
2
+ import { validate } from "npm:@hyperjump/json-schema/draft-07" ;
3
+ import { BASIC } from "npm:@hyperjump/json-schema/experimental" ;
4
+
5
+ const validateTestSuite = await validate ( "./annotations/test-suite.schema.json" ) ;
6
+
7
+ console . log ( "Validating annotation tests ..." ) ;
8
+
9
+ let isValid = true ;
10
+ for await ( const entry of Deno . readDir ( "./annotations/tests" ) ) {
11
+ if ( entry . isFile ) {
12
+ const json = await Deno . readTextFile ( `./annotations/tests/${ entry . name } ` ) ;
13
+ const suite = JSON . parse ( json ) ;
14
+
15
+ const output = validateTestSuite ( suite , BASIC ) ;
16
+
17
+ if ( output . valid ) {
18
+ console . log ( `\x1b[32m✔\x1b[0m ${ entry . name } ` ) ;
19
+ } else {
20
+ isValid = false ;
21
+ console . log ( `\x1b[31m✖\x1b[0m ${ entry . name } ` ) ;
22
+ console . log ( output ) ;
23
+ }
24
+ }
25
+ }
26
+
27
+ console . log ( "Done." ) ;
28
+
29
+ if ( ! isValid ) {
30
+ Deno . exit ( 1 ) ;
31
+ }
You can’t perform that action at this time.
0 commit comments