diff --git a/test/cli.js b/test/cli.js index 7149d33..5e74b28 100644 --- a/test/cli.js +++ b/test/cli.js @@ -1,5 +1,5 @@ import { exec as execCallback } from "node:child_process"; -import { join as joinPaths, dirname as pathDirname } from "node:path"; +import { join as joinPaths, dirname as pathDirname, sep } from "node:path"; import { fileURLToPath } from "node:url"; import { promisify } from "node:util"; import tap from "tap"; @@ -21,10 +21,10 @@ const cwd = joinPaths(dirname, ".."); const sizeOfFixtureFolder = "0.01 MB"; for (const folderArg of ["--folder=", "-f=", ""]) { - const args = `${folderArg}test/fixture`; + const args = `${folderArg}test${sep}fixture`; tap.test(`get folder size with args: ${args}`, async () => { - const result = await exec(`bin/get-folder-size.js ${args}`, { + const result = await exec(`bin${sep}get-folder-size.js ${args}`, { cwd, }); @@ -36,14 +36,17 @@ for (const folderArg of ["--folder=", "-f=", ""]) { for (const ignoreArg of ["--ignore=", "-i="]) { for (const flipArgs of [false, true]) { - const arg1 = `${folderArg}test/fixture`; + const arg1 = `${folderArg}test${sep}fixture`; const arg2 = `${ignoreArg}.*txt`; const args = flipArgs ? `${arg2} ${arg1}` : `${arg1} ${arg2}`; tap.test(`get folder size with args: ${args}`, async () => { - const result = await exec(`bin/get-folder-size.js ${args}`, { - cwd, - }); + const result = await exec( + `bin${sep}get-folder-size.js ${args}`, + { + cwd, + }, + ); tap.ok( result.stdout.startsWith("0.00 MB"), @@ -56,6 +59,6 @@ for (const folderArg of ["--folder=", "-f=", ""]) { tap.test("get folder size with missing args", async () => { tap.rejects(async () => { - await exec("bin/get-folder-size.js", { cwd }); + await exec(`bin${sep}get-folder-size.js`, { cwd }); }, "should reject since no folder path is provided"); });