File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212const shell = require ( 'shelljs' ) ;
1313const helpers = require ( './helpers' ) ;
1414
15+ const stubResult = shell . exec ( 'scripts/stub-check' ) . code ;
16+ if ( stubResult != 0 ) { shell . exit ( stubResult ) ; }
17+
1518const checkResult = shell . exec ( 'scripts/checksum' ) . code ;
1619if ( checkResult != 0 ) { shell . exit ( checkResult ) ; }
1720
Original file line number Diff line number Diff line change 44 */
55
66const shell = require ( 'shelljs' ) ;
7+ const fs = require ( 'fs' ) ;
78
89const exerciseDirs = shell . ls ( '-d' , 'exercises/*' ) ;
910
10- const assignments = exerciseDirs . map ( dir => dir . split ( '/' ) [ 1 ] ) ;
11+ const config = JSON . parse ( fs . readFileSync ( 'config.json' ) ) [ 'exercises' ] ;
12+ const assignments = exerciseDirs . map ( dir => dir . split ( '/' ) [ 1 ] )
13+ . filter ( exercise => ! exercise . deprecated ) ;
1114
1215// Preapre all exercises (see above) & run a given command
1316function prepareAndRun ( command , infoStr , failureStr ) {
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+
3+ /**
4+ * Run this script (from root directory): npx @babel/node scripts/stub-check
5+ *
6+ * This script checks that all exercises have a stub file.
7+ * Ref: https://github.com/exercism/javascript/issues/705
8+ */
9+
10+ const shell = require ( 'shelljs' ) ;
11+ const helpers = require ( './helpers' ) ;
12+
13+ const noStubs = helpers . assignments . filter (
14+ assignment => ! shell . test ( '-f' , `exercises/${ assignment } /${ assignment } .js` )
15+ ) ;
16+ if ( noStubs . length > 0 ) {
17+ shell . echo ( '[Error]: No stub files found for following exercises:' ) ;
18+ shell . echo ( noStubs . join ( '\n' ) ) ;
19+ shell . exit ( 1 ) ;
20+ }
21+ else {
22+ shell . echo ( '[Success]: Stub files present for all exercises!' ) ;
23+ }
You can’t perform that action at this time.
0 commit comments