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

Commitfa95c69

Browse files
authored
Merge pull requestcoderoad#189 from ShMcK/fix/multiple-watcher-fires
fix multiple watcher firings
2 parents4528f98 +16cea0b commitfa95c69

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

‎src/actions/utils/loadWatchers.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,18 @@ const loadWatchers = (watchers: string[], workspaceUri: vscode.Uri) => {
3434
interval:1000,
3535
})
3636

37+
// prevent firing tests within 1 second of last test check
38+
constlastFire:Date|null=null
39+
40+
// run tests on watcher change
3741
fsWatcher.on('change',(path,event)=>{
38-
vscode.commands.executeCommand(COMMANDS.RUN_TEST,null,()=>{
39-
// cleanup watcher on success
40-
disposeWatcher(watcher)
41-
})
42+
constnow=+newDate()
43+
if(!lastFire||lastFire-now>1000){
44+
vscode.commands.executeCommand(COMMANDS.RUN_TEST,null,()=>{
45+
// cleanup watcher on success
46+
disposeWatcher(watcher)
47+
})
48+
}
4249
})
4350

4451
// key fs watcher on name

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp