You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/tutorial-docs/2016-01-09-test-runner.md
+11-9Lines changed: 11 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,12 @@ A CodeRoad test runner works by creating a child process and calling a test fram
9
9
10
10
In this way, the test runner not only determines how unit tests will be written, but it actually determines the programming language used in the tutorial.
11
11
12
-
>Any programming language can potentially be used with CodeRoad, you need only change the test runner.
12
+
>Any programming language can potentially be used with CodeRoad, you need only change the test runner. This is possible because tests are called from the command line.
@@ -28,32 +29,33 @@ The test runner is called in *Atom-CodeRoad* with three ordered inputs, the fina
28
29
See a brief example from the[*mocha-coderoad* runner](https://github.com/coderoad/mocha-coderoad/blob/master/src/runner.ts), as well as a code summary below:
Also notice that the runner in the above example handles any`console.log` statements. A special character string is added before the result, any data without that match is passed to the log.
38
40
39
-
`console.dir` is used to make objects & arrays more accessible in the console.
40
-
41
41
```js
42
42
if (!match) {
43
43
try {
44
-
console.dir(JSON.parse(JSON.stringify(data)));
44
+
console.log(data);
45
45
}catch (e) {
46
46
console.log(data);
47
47
}
48
48
return;
49
49
}
50
50
```
51
51
52
-
Let's look at these three test runner inputs in more detail.
52
+
>In order to process the data correctly, CodeRoad overrides the console.log function with another function that parses the output and returns it's proper type.
53
+
54
+
Let's look at these three test runner keys that are passed into the runner as an object:
53
55
54
-
####1.testFile
56
+
####1.testString
55
57
56
-
The absolute path to a file containing all concatenated pagetests. Call your test framework with this file path.
58
+
A string with all test input. This includes unittests, the user input from the text editor, and some helper functions behind the scenes.