File tree 6 files changed +39
-21
lines changed
6 files changed +39
-21
lines changed Original file line number Diff line number Diff line change @@ -248,3 +248,8 @@ Adds a review page for viewing tutorial content. The review page should be espec
248
248
- Supports commands on reset
249
249
- Supports running vscode commands anywhere that command line commands can be run
250
250
- Admin mode to allow creators to jump between tutorial levels/steps during development
251
+
252
+ ### [0.13.1]
253
+
254
+ - Add logo
255
+ - Fix issue with watcher tests running on reset
Original file line number Diff line number Diff line change 1
- import * as T from 'typings'
2
1
import * as TT from 'typings/tutorial'
3
2
import * as git from '../git'
4
3
import loadCommits from './utils/loadCommits'
5
- import loadWatchers from './utils/loadWatchers '
4
+ import { loadWatchers , resetWatchers } from './utils/watchers '
6
5
import openFiles from './utils/openFiles'
7
6
import runCommands from './utils/runCommands'
8
7
import runVSCodeCommands from './utils/runVSCodeCommands'
@@ -39,6 +38,7 @@ export const onSolutionEnter = async (actions: TT.StepActions): Promise<void> =>
39
38
}
40
39
41
40
export const onReset = async ( actions : TT . StepActions ) : Promise < void > => {
41
+ await resetWatchers ( )
42
42
await runCommands ( actions ?. commands )
43
43
await runVSCodeCommands ( actions ?. vscodeCommands )
44
44
}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const disposeWatcher = (watcher: string) => {
14
14
delete watcherObject [ watcher ]
15
15
}
16
16
17
- const loadWatchers = ( watchers : string [ ] = [ ] ) : void => {
17
+ export const loadWatchers = ( watchers : string [ ] = [ ] ) : void => {
18
18
if ( ! watchers . length ) {
19
19
// remove all watchers
20
20
for ( const watcher of Object . keys ( watcherObject ) ) {
@@ -55,4 +55,8 @@ const loadWatchers = (watchers: string[] = []): void => {
55
55
}
56
56
}
57
57
58
- export default loadWatchers
58
+ export const resetWatchers = ( ) : void => {
59
+ for ( const watcher of Object . keys ( watcherObject ) ) {
60
+ disposeWatcher ( watcher )
61
+ }
62
+ }
Original file line number Diff line number Diff line change @@ -89,27 +89,28 @@ export interface MachineStateSchema {
89
89
states : {
90
90
Setup : {
91
91
states : {
92
- Startup : { }
93
- ValidateSetup : { }
94
- Start : { }
95
- SelectTutorial : { }
96
- SetupNewTutorial : { }
97
- StartTutorial : { }
92
+ Startup : Record < string , unknown >
93
+ ValidateSetup : Record < string , unknown >
94
+ Start : Record < string , unknown >
95
+ SelectTutorial : Record < string , unknown >
96
+ SetupNewTutorial : Record < string , unknown >
97
+ StartTutorial : Record < string , unknown >
98
98
}
99
99
}
100
100
Tutorial : {
101
101
states : {
102
102
Level : {
103
103
states : {
104
- Load : { }
105
- Normal : { }
106
- TestRunning : { }
107
- StepNext : { }
108
- LevelComplete : { }
109
- LoadNext : { }
104
+ Load : Record < string , unknown >
105
+ Normal : Record < string , unknown >
106
+ TestRunning : Record < string , unknown >
107
+ StepNext : Record < string , unknown >
108
+ LevelComplete : Record < string , unknown >
109
+ LoadNext : Record < string , unknown >
110
110
}
111
111
}
112
- Completed : { }
112
+ Reset : Record < string , unknown >
113
+ Completed : Record < string , unknown >
113
114
}
114
115
}
115
116
}
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ const Routes = () => {
42
42
< Route paths = { { Tutorial : { Level : { Load : true } } } } >
43
43
< LoadingPage text = "Loading Level..." processes = { context . processes } />
44
44
</ Route >
45
+ < Route paths = { { Tutorial : { Reset : true } } } >
46
+ < LoadingPage text = "Resetting tutorial..." processes = { context . processes } />
47
+ </ Route >
45
48
< Route paths = { { Tutorial : { Level : true , Completed : true } } } >
46
49
< TutorialPage send = { send } context = { context } state = { route . replace ( 'Tutorial.' , '' ) } />
47
50
</ Route >
Original file line number Diff line number Diff line change @@ -69,7 +69,6 @@ export const createMachine = (options: any) => {
69
69
target : 'SetupNewTutorial' ,
70
70
actions : [ 'setTutorialContext' ] ,
71
71
} ,
72
- // TODO: handle completed tutorial differently
73
72
TUTORIAL_ALREADY_COMPLETE : {
74
73
target : 'Start' ,
75
74
actions : [ 'setStart' ] ,
@@ -168,9 +167,7 @@ export const createMachine = (options: any) => {
168
167
RUN_TEST : {
169
168
actions : [ 'runTest' ] ,
170
169
} ,
171
- RUN_RESET : {
172
- actions : [ 'runReset' ] ,
173
- } ,
170
+ RUN_RESET : '#reset-tutorial' ,
174
171
KEY_PRESS_ENTER : {
175
172
actions : [ 'runTest' ] ,
176
173
} ,
@@ -234,6 +231,14 @@ export const createMachine = (options: any) => {
234
231
} ,
235
232
} ,
236
233
} ,
234
+ Reset : {
235
+ id : 'reset-tutorial' ,
236
+ onEntry : [ 'runReset' ] ,
237
+ onExit : [ 'testClear' ] ,
238
+ after : {
239
+ 3000 : '#tutorial' ,
240
+ } ,
241
+ } ,
237
242
Completed : {
238
243
id : 'completed-tutorial' ,
239
244
on : {
You can’t perform that action at this time.
0 commit comments