From ed1bea77ac7a659fb204eddc5a17defd210563c2 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Sat, 17 Feb 2024 16:52:12 -0800 Subject: [PATCH] test: create a broken link inside temp directory 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. --- test/touch.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/touch.js b/test/touch.js index 7ca36516..703ea2a5 100644 --- a/test/touch.js +++ b/test/touch.js @@ -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`)); }); });