Skip to content

Commit 01652d6

Browse files
committed
chore: refactor test to make it pass
1 parent a8ef272 commit 01652d6

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

src/__tests__/index.spec.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -285,19 +285,20 @@ describe('copyfiles', () => {
285285
}).toThrow('nothing copied');
286286
});
287287

288-
test('sets followSymbolicLinks when options.follow is true', (done: any) => {
289-
if (process.platform === 'win32') return done();
288+
test('sets followSymbolicLinks when options.follow is true', async () => {
289+
if (process.platform === 'win32') return;
290290
mkdirSync('input/real', { recursive: true });
291291
writeFileSync('input/real/a.txt', 'test');
292292
symlinkSync('real', 'input/link');
293-
// Check if symlink was created as a directory symlink
294-
if (!lstatSync('input/link').isSymbolicLink()) return done();
295-
copyfiles(['input/link/*.txt', 'output'], { follow: true }, (err) => {
296-
const files = globSync('output/**/*', { dot: true });
297-
console.log('output contents:', files);
298-
const found = files.some(f => f.endsWith('a.txt'));
299-
expect(found).toBe(true);
300-
done();
293+
await new Promise<void>((resolve, reject) => {
294+
copyfiles(['input/link/*.txt', 'output'], { follow: true }, (err) => {
295+
const files = globSync('output/**/*', { dot: true });
296+
console.log('output contents:', files);
297+
const found = files.some(f => f.endsWith('a.txt'));
298+
expect(found).toBe(true);
299+
if (err) reject(err);
300+
else resolve();
301+
});
301302
});
302303
});
303304

0 commit comments

Comments
 (0)