Skip to content

Commit 3a8a78d

Browse files
author
Jon Myrick
authored
Merge pull request CodewarsClone#2 from CodewarsClone/Docker-Setup
Docker setup
2 parents d5ecc28 + f5ce38b commit 3a8a78d

3 files changed

Lines changed: 45 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
.idea
12
node_modules
23
config.js
4+
test.js

controllers/testCtrl.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+

package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
}

0 commit comments

Comments
 (0)