diff --git a/test/mkdir.js b/test/mkdir.js index 5a6f185f..92ab513e 100644 --- a/test/mkdir.js +++ b/test/mkdir.js @@ -87,7 +87,7 @@ test('try to make a subdirectory of a file', t => { test('Check for invalid permissions', t => { utils.skipOnWin(t, () => { // This test case only works on unix, but should work on Windows as well - const dirName = 'nowritedir'; + const dirName = `${t.context.tmp}/nowritedir`; shell.mkdir(dirName); t.falsy(shell.error()); shell.chmod('-w', dirName); @@ -95,11 +95,10 @@ test('Check for invalid permissions', t => { t.is(result.code, 1); t.is( result.stderr, - 'mkdir: cannot create directory nowritedir/foo: Permission denied' + `mkdir: cannot create directory ${t.context.tmp}/nowritedir/foo: Permission denied` ); t.truthy(shell.error()); t.falsy(fs.existsSync(dirName + '/foo')); - shell.rm('-rf', dirName); // clean up }); }); @@ -142,7 +141,6 @@ test('-p flag', t => { t.falsy(shell.error()); t.is(result.code, 0); t.truthy(fs.existsSync(`${t.context.tmp}/a/b/c`)); - shell.rm('-Rf', `${t.context.tmp}/a`); // revert }); test('-p flag: multiple dirs', t => { 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`)); }); });