@@ -8,7 +8,7 @@ import * as workspace from "./workspace"
8
8
/** the action that should happen when the user saves a file */
9
9
const enum ActionOnSave {
10
10
none ,
11
- testCurrentFile ,
11
+ testActiveFile ,
12
12
repeatLastTest
13
13
}
14
14
@@ -32,26 +32,13 @@ export function activate(context: vscode.ExtensionContext) {
32
32
)
33
33
}
34
34
35
- async function allOnSave ( ) {
36
- notification . display ( "running all tests on save" )
37
- actionOnSave = ActionOnSave . repeatLastTest
38
- lastTest = `{ "command": "test-all" }`
39
- await pipe . send ( lastTest )
40
- }
41
-
42
- async function allOnce ( ) {
43
- notification . display ( "testing all files" )
44
- lastTest = `{ "command": "test-all" }`
45
- await pipe . send ( lastTest )
46
- }
47
-
48
35
async function activeFileOnSave ( ) {
49
- if ( actionOnSave === ActionOnSave . testCurrentFile ) {
36
+ if ( actionOnSave === ActionOnSave . testActiveFile ) {
50
37
actionOnSave = ActionOnSave . none
51
- notification . display ( "test current file on save OFF" )
38
+ notification . display ( "test active file on save OFF" )
52
39
} else {
53
- actionOnSave = ActionOnSave . testCurrentFile
54
- notification . display ( "test current file on save ON" )
40
+ actionOnSave = ActionOnSave . testActiveFile
41
+ notification . display ( "test active file on save ON" )
55
42
try {
56
43
const relPath = workspace . currentFile ( )
57
44
await pipe . send ( `{ "command": "test-file", "file": "${ relPath } " }` )
@@ -61,14 +48,27 @@ async function activeFileOnSave() {
61
48
}
62
49
}
63
50
51
+ async function allOnce ( ) {
52
+ notification . display ( "testing all files" )
53
+ lastTest = `{ "command": "test-all" }`
54
+ await pipe . send ( lastTest )
55
+ }
56
+
57
+ async function allOnSave ( ) {
58
+ notification . display ( "running all tests on save" )
59
+ actionOnSave = ActionOnSave . repeatLastTest
60
+ lastTest = `{ "command": "test-all" }`
61
+ await pipe . send ( lastTest )
62
+ }
63
+
64
64
function documentSaved ( ) {
65
65
switch ( actionOnSave ) {
66
66
case ActionOnSave . none :
67
67
break
68
68
case ActionOnSave . repeatLastTest :
69
69
wrapLogger ( repeatOnce ) ( )
70
70
break
71
- case ActionOnSave . testCurrentFile :
71
+ case ActionOnSave . testActiveFile :
72
72
wrapLogger ( thisFileOnce ) ( )
73
73
break
74
74
}
0 commit comments