Skip to content

Commit d16194e

Browse files
committed
improved docs
1 parent 51e3297 commit d16194e

File tree

6 files changed

+111
-14
lines changed

6 files changed

+111
-14
lines changed

_includes/docs/docs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h1 id="overview" class="page-header">Overview</h1>
1313
CodeRoad aims to make building & sharing interactive tutorials as easy as possible.
1414
</blockquote>
1515

16-
<div class="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+
<div class="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>
1717

1818
<a href="/build" class="btn btn-default btn-lg"><i class="fa fa-road fa-fw"></i> <span class="network-name">Read an Overview of Building a Tutorial</span></a>
1919

_posts/2016-01-01-installation.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ id: install
55
file: 2016-01-01-installation.md
66
---
77

8-
To build a tutorial with CodeRoad, you'll need to install both **Atom-CodeRoad** & the **CodeRoad-CLI**.
8+
To play a tutorial, you'll only need **Atom-CodeRoad**.
9+
10+
But to build a tutorial, you'll also need the **CodeRoad-CLI**.
911

1012
### Atom CodeRoad
1113

_posts/2016-01-02-development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ file: 2016-01-02-development.md
77

88
### Create
99

10-
To get setup quickly with CodeRoad, either clone a tutorial repo or use the CLI.
10+
Get setup quickly with CodeRoad: either [clone a tutorial repo](https://git-scm.com/docs/git-clone) or use the *CodeRoad-CLI*.
1111

1212
In your development directory, run **create** with your new package name.
1313

_posts/2016-01-07-test-examples.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,43 @@ file: 2016-01-07-test-examples.md
77

88
Here are examples using *mocha* with *chai*'s *expect*. See the [docs](http://chaijs.com/api/bdd/).
99

10-
##### exists
10+
#### exists
1111

1212
it('doesn\'t exist', function() {
1313
expect(target).to.not.be.undefined;
1414
});
1515

16-
##### type
16+
#### type
1717

1818
it('should be a function', function() {
1919
expect(target).to.be.a('function');
2020
});
2121

22-
##### function params
22+
#### function params
2323

2424
it('should have two parameters', function() {
2525
expect(target).to.have.length(2);
2626
});
2727

28-
##### function returns
28+
#### function returns
2929

3030
it('should add one to the number', function () {
3131
expect(addOne(1)).to.equal(2);
3232
});
3333

34-
##### equals
34+
#### equals
3535

3636
it('should be 42', function () {
3737
expect(target).to.equal(42);
3838
});
3939

40-
##### deep equals (with objects or arrays)
40+
#### deep equals (with objects or arrays)
4141

4242
it('should be {a: 42}', function () {
4343
expect(target).to.deep.equal({a: 42});
4444
});
4545

46-
##### regex
46+
#### regex
4747

4848
it('should access the property "prop"', function () {
4949
var regex1 = /\.prop/; // dot notation
@@ -53,7 +53,7 @@ Here are examples using *mocha* with *chai*'s *expect*. See the [docs](http://ch
5353
expect(result).to.be.true;
5454
});
5555

56-
##### spies
56+
#### spies
5757

5858
You can use [*sinon*](http://sinonjs.org/docs/) or [*chai-spies*](https://github.com/chaijs/chai-spies) to create a spy. See an example below:
5959

_posts/2016-01-08-config.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,29 @@ title: Config
44
id: config
55
file: 2016-01-08-config.md
66
---
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).

_posts/2016-01-10-testRunner.md

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,78 @@ title: Test Runners
44
id: test-runner
55
file: 2016-01-10-testRunner.md
66
---
7-
coming soon
7+
A test runner works by creating a child process and calling a test framework with target files.
88

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.
12+
13+
### Current Test Runners
14+
15+
* Javascript: [*mocha-coderoad*](https://github.com/coderoad/mocha-coderoad)
1016

1117
### How to Build a Test Runner
18+
19+
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

Comments
 (0)