Skip to content

Commit afde92a

Browse files
committed
test: minor refactor
1 parent 76cb3a4 commit afde92a

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

__tests__/fdir.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -380,22 +380,22 @@ for (const type of apiTypes) {
380380
});
381381
}
382382

383-
test(`[async] crawl directory & use abort signal to abort`, async (t) => {
384-
// AbortController is not present on Node v14
385-
if (!("AbortController" in globalThis)) return;
386-
387-
const totalFiles = new fdir().onlyCounts().crawl("node_modules").sync();
388-
const abortController = new AbortController();
389-
const api = new fdir()
390-
.withAbortSignal(abortController.signal)
391-
.filter((p) => {
392-
if (p.endsWith(".js")) abortController.abort();
393-
return true;
394-
})
395-
.crawl("node_modules");
396-
const files = await api.withPromise();
397-
t.expect(files.length).toBeLessThan(totalFiles.files);
398-
});
383+
// AbortController is not present on Node v14
384+
if ("AbortController" in globalThis) {
385+
test(`[async] crawl directory & use abort signal to abort`, async (t) => {
386+
const totalFiles = new fdir().onlyCounts().crawl("node_modules").sync();
387+
const abortController = new AbortController();
388+
const api = new fdir()
389+
.withAbortSignal(abortController.signal)
390+
.filter((p) => {
391+
if (p.endsWith(".js")) abortController.abort();
392+
return true;
393+
})
394+
.crawl("node_modules");
395+
const files = await api.withPromise();
396+
t.expect(files.length).toBeLessThan(totalFiles.files);
397+
});
398+
}
399399

400400
test(`paths should never start with ./`, async (t) => {
401401
const apis = [

0 commit comments

Comments
 (0)