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
CodeRoad aims to make building & sharing interactive tutorials as easy as possible.
14
14
</blockquote>
15
15
16
-
<divclass="lead">We hope to create fun and maintainable coding tutorials that actually improve with time. We hope to create a world where students become teachers, teachers become empowered & coders become better, faster. But first, we need to get some tutorials built.</div>
16
+
<divclass="lead">We hope to create fun and maintainable coding tutorials that actually improve with time. We hope to see students become teachers, teachers become empowered, and coders become better, faster. But first, let's get some interactive tutorials built. That's where you come in.</div>
17
17
18
18
<ahref="/build" class="btn btn-default btn-lg"><iclass="fa fa-road fa-fw"></i><spanclass="network-name">Read an Overview of Building a Tutorial</span></a>
Copy file name to clipboardExpand all lines: _posts/2016-01-08-config.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,29 @@ title: Config
4
4
id: config
5
5
file: 2016-01-08-config.md
6
6
---
7
-
coming soon
7
+
CodeRoad tutorial configurations can be set in the *package.json* config.
8
+
9
+
"config": {
10
+
"testDir": "tutorial",
11
+
"testSuffix": ".spec.js",
12
+
"testRunner": "mocha-coderoad",
13
+
"edit": true
14
+
}
15
+
16
+
This section will likely expand in the future. For now, let's go over some of these.
17
+
18
+
#### testDir
19
+
20
+
The relative path to the unit test directory. This makes writing unit tests paths easier.
21
+
22
+
#### testSuffix
23
+
24
+
The common suffix for unit tests. Also making writing unit test paths shorter.
25
+
26
+
#### testRunner
27
+
28
+
Specified test runner. Currently only "mocha-coderoad" is available.
29
+
30
+
#### edit
31
+
32
+
If set to true, *Atom-CodeRoad* will allow users to submit issues or submit markdown pull requests. You will also need to specify "repository" & "bugs" in your *package.json* file. See an [example config file](https://github.com/coderoad/coderoad-functional-school/blob/master/package.json).
Copy file name to clipboardExpand all lines: _posts/2016-01-10-testRunner.md
+72-2Lines changed: 72 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,78 @@ title: Test Runners
4
4
id: test-runner
5
5
file: 2016-01-10-testRunner.md
6
6
---
7
-
coming soon
7
+
A test runner works by creating a child process and calling a test framework with target files.
8
8
9
-
### Mocha-CodeRoad
9
+
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.
10
+
11
+
> Any programming language could be used with CodeRoad, you need only change the test runner.
If you're interested in helping CodeRoad support a programming language of your choice, here's how to set up the test runner.
20
+
21
+
The test runner should spawn a child process. Think of this like your program opening up a terminal, typing in command line commands, then collecting and returning the the results to *Atom-CodeRoad*. See [an example child process created in *mocha-coderoad*](https://github.com/coderoad/mocha-coderoad/blob/master/src/create-runner.js).
22
+
23
+
The test runner is called with four ordered inputs, two of which act as callback functions that return the log & result to *Atom-CodeRoad*.
24
+
25
+
See a brief example from the [*mocha-coderoad* runner](https://github.com/coderoad/mocha-coderoad/blob/master/src/runner.js).
26
+
27
+
28
+
export default function runner(testFile, config, handleResult, handleLog) {
29
+
...
30
+
handleLog(msg); // returns log
31
+
...
32
+
handleResult(result); // returns test result
33
+
}
34
+
35
+
Let's look at these four inputs in more detail.
36
+
37
+
#### 1. testFile
38
+
39
+
The absolute path to a file containing all concatenated page tests. Call your test framework with this.
40
+
41
+
#### 2. config
42
+
43
+
A JSON object of configurations, see an example below
44
+
45
+
46
+
{
47
+
"dir": "path/to/user/project",
48
+
"tutorial": "coderoad-package-name",
49
+
"tutorialDir": "/path/to/installed/tutorial/",
50
+
"taskPosition": 0
51
+
}
52
+
53
+
54
+
#### 3. handleResult
55
+
56
+
A callback function that should be called with the **result** object. Results should either pass if all pass, or fail if any test fails.
57
+
58
+
##### pass
59
+
60
+
{
61
+
"pass": true,
62
+
"taskPosition": 1,
63
+
"change": 1,
64
+
"msg": "Task 1 Complete"
65
+
}
66
+
67
+
The result should output the 'taskPosition' after the test. 'change' represents the difference between the starting 'taskPosition' and the resulting 'taskPosition'.
68
+
69
+
##### fail
70
+
71
+
{
72
+
"pass": false,
73
+
"taskPosition": 0,
74
+
"change": 0,
75
+
"msg": "`var secret` should be 42",
76
+
"timedOut": false
77
+
}
78
+
79
+
#### 4. handleLog
80
+
81
+
A callback function that should be called with a string **log** statement
0 commit comments