File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Validate annotation tests
2+
3+ on :
4+ push :
5+
6+ jobs :
7+ annotate :
8+ runs-on : ubuntu-latest
9+
10+ steps :
11+ - uses : actions/checkout@v4
12+
13+ - name : Set up Deno
14+ uses : denoland/setup-deno@v2
15+ with :
16+ deno-version : " 2.x"
17+
18+ - name : Validate annotation tests
19+ 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