File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ .idea
12node_modules
23config.js
4+ test.js
Original file line number Diff line number Diff line change 1+ /**
2+ * Created by Joshua Baert on 12/15/2016.
3+ *
4+ * This Controller is where we take take a script as a string then run our tests against it
5+ *
6+ */
7+
8+ const exec = require ( 'child_process' ) . exec ;
9+
10+ let script = `let addTwo = (x) => {return x+2};` ;
11+ let test = `Test.assertEquals(addTwo(2), 4)` ;
12+
13+
14+ // This is where wer run a script.. I have verified that so long as we get it in string format we run unit tests
15+ exec ( `docker run --rm codewars/node-runner run -l javascript -c "${ script } " -t cw -f "${ test } "` ,
16+ ( err , stdout , stderr ) => {
17+ if ( err ) console . log ( 'err' , err ) ;
18+ console . log ( typeof stdout ) ;
19+ console . log ( 'stdout' , stdout ) ;
20+ console . log ( 'stderr' , stderr ) ;
21+ } ) ;
22+
23+
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " codewars" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " Codewars clone" ,
5+ "main" : " server.js" ,
6+ "scripts" : {
7+ "test" : " echo \" Error: no test specified\" && exit 1" ,
8+ "start" : " node server.js"
9+ },
10+ "repository" : {
11+ "type" : " git" ,
12+ "url" : " git+https://github.com/CodewarsClone/Codewars.git"
13+ },
14+ "author" : " " ,
15+ "license" : " ISC" ,
16+ "bugs" : {
17+ "url" : " https://github.com/CodewarsClone/Codewars/issues"
18+ },
19+ "homepage" : " https://github.com/CodewarsClone/Codewars#readme"
20+ }
You can’t perform that action at this time.
0 commit comments