Skip to content

Commit

Permalink
chore(test): Fixed test helper function in test.watcher.js based on c…
Browse files Browse the repository at this point in the history
…hanges to watchpack@2 internals
  • Loading branch information
rpl committed Jan 19, 2021
1 parent ed4a10e commit bae0fcd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/unit/test.watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,17 @@ describe('watcher', () => {
});
})
.then((watcher) => {
const watchedFile = watcher.fileWatchers[0];
const watchedDir = watcher.dirWatchers[0];
const {fileWatchers, directoryWatchers} = watcher;
let watchedFile;
let watchedDir;

if (fileWatchers?.size > 0) {
watchedFile = Array.from(fileWatchers.values())[0];
}

if (directoryWatchers?.size > 0) {
watchedDir = Array.from(directoryWatchers.values())[0];
}

watchedFilePath = watchedFile && watchedFile.path;
watchedDirPath = watchedDir && watchedDir.path;
Expand Down

0 comments on commit bae0fcd

Please sign in to comment.