Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc542a1d

Browse files
committed
add subtask example
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent21af0c8 commitc542a1d

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

‎docs/docs/hooks-actions.md

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ The above example will open the "README.md" file in the users workspace. Note th
8787

8888
### `filter` (string)
8989

90-
Aregex passed into the test runner to limit the tests returned
90+
Aglob passed into the test runner to limit the tests returned.
9191

9292
```yaml
9393
setup:
94-
filter: 'level_1_tests'
94+
filter: 'tests/{level1, level2}/*'
9595
```
9696

9797
Will restrict tests to only run a subset of tests that match the filter. Filter depends on your test runner, and can be configured in the test runner.
@@ -106,6 +106,48 @@ config:
106106

107107
Essentially, the above example will run `./node_modules/.bin/mocha --grep level_1_tests` as the test command.
108108

109-
###`subtasks` (boolean)
109+
### subtasks
110110

111-
A task made up of multiple other tests where all must pass to continue
111+
A task made up of multiple other tests where all must pass to continue.
112+
113+
![subtask example](/gif/subtask-demo.gif)
114+
115+
See an [example](https://github.com/shmck/coderoad-tutorial-subtask-demo).
116+
117+
Subtasks do not require any config, but may be written in the TUTORIAL.md with corresponding test names.
118+
119+
##### 1. Add the subtask titles to the TUTORIAL.md
120+
121+
```md
122+
## 1. Subtask Example
123+
124+
A subtask example
125+
126+
### 1.1
127+
128+
Create a function`add` that can take a variety of params.
129+
130+
#### SUBTASKS
131+
132+
-Add one number
133+
-Add two numbers
134+
-Add three numbers
135+
```
136+
137+
##### 2. Label the tests with`:#`
138+
139+
As an example, the below test corresponds to the index of the first subtask ("Add one number").
140+
141+
```js
142+
it(':1 should add one number', function () {
143+
const result = add(1) === 1
144+
const message = 'Should accept a single param'
145+
assert.ok(result, message)
146+
const result2 = add(42) === 42
147+
assert.ok(result2, message)
148+
})
149+
```
150+
151+
See [an example subtask test file](https://github.com/ShMcK/coderoad-tutorial-subtask-demo/blob/v0.2.1/.coderoad/test/add.test.js) for more.
152+
153+
The number of subtasks should match the number of tests being run. If this is not the case, use [filter](#filter-string) to limit the tests.

‎docs/static/gif/subtask-demo.gif

1.55 MB
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp