Skip to content

Commit

Permalink
test: create a broken link inside temp directory
Browse files Browse the repository at this point in the history
No change to logic. This updates a test case to create the files it
needs inside the temp directory instead of in the repo itself. This is
helpful in case the test case fails early, that way we don't leave this
file behind.

This contributes toward #828, since the change to fast-glob made it
clear that this test was mishandling link files and leaving side effects
in the git repo.
  • Loading branch information
nfischer committed Feb 18, 2024
1 parent a6d1e49 commit ed1bea7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/touch.js
Expand Up @@ -186,10 +186,10 @@ test('file array', t => {

test('touching broken link creates a new file', t => {
utils.skipOnWin(t, () => {
const result = shell.touch('test/resources/badlink');
shell.ln('-s', 'not_existed_file', `${t.context.tmp}/badlink2`);
const result = shell.touch(`${t.context.tmp}/badlink2`);
t.is(result.code, 0);
t.falsy(shell.error());
t.truthy(fs.existsSync('test/resources/not_existed_file'));
shell.rm('test/resources/not_existed_file');
t.truthy(fs.existsSync(`${t.context.tmp}/not_existed_file`));
});
});

0 comments on commit ed1bea7

Please sign in to comment.