| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a124429 commit a56fbb2
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,15 +34,22 @@ describe('watch file with shared dependency', () => { | |||
| 34 | 34 | const controller = new AbortController(); | |
| 35 | 35 | const watcher = new FilesWatcher({ signal: controller.signal }); | |
| 36 | 36 | ||
| 37 | - watcher.on('changed', common.mustCall(({ owners }) => { | ||
| 38 | - if (owners.size !== 2) return; | ||
| 39 | - | ||
| 40 | - // If this code is never reached the test times out. | ||
| 37 | + const onExpectedOwners = common.mustCall(({ owners }) => { | ||
| 41 | 38 | assert.ok(owners.has(fixturePaths['test.js'])); | |
| 42 | 39 | assert.ok(owners.has(fixturePaths['test-2.js'])); | |
| 43 | 40 | controller.abort(); | |
| 44 | 41 | done(); | |
| 45 | - })); | ||
| 42 | + }); | ||
| 43 | + | ||
| 44 | + function onChanged({ owners }) { | ||
| 45 | + if (owners.size !== 2) return; | ||
| 46 | + | ||
| 47 | + // If this code is never reached the test times out. | ||
| 48 | + watcher.removeListener('changed', onChanged); | ||
| 49 | + onExpectedOwners({ owners }); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + watcher.on('changed', onChanged); | ||
| 46 | 53 | watcher.filterFile(fixturePaths['test.js']); | |
| 47 | 54 | watcher.filterFile(fixturePaths['test-2.js']); | |
| 48 | 55 | watcher.filterFile(fixturePaths['dependency.js'], fixturePaths['test.js']); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments