diff --git a/test/integration/commands/create.test.ts b/test/integration/commands/create.test.ts index 8728df8..add5e60 100644 --- a/test/integration/commands/create.test.ts +++ b/test/integration/commands/create.test.ts @@ -1,29 +1,30 @@ import test from "ava"; import { resolve } from "path"; +import { rm } from "fs/promises"; import { shell } from "await-shell"; import { tmpdir } from "os"; -process.chdir(tmpdir()); +const testModuleDir = resolve(tmpdir(), "test-module"); + await shell("yarn link @tsmodule/tsmodule"); +await rm(testModuleDir, { recursive: true, force: true }); test.serial("`create` should generate TS module package", async (t) => { t.timeout(120_000); - await shell("tsmodule create test-module"); + await shell(`cd ${tmpdir()} && tsmodule create test-module`); /** * `tsmodule create` adds a `@tsmodule/tsmodule` dependency, so re-link it in * the test module. */ - await shell("yarn --cwd test-module link @tsmodule/tsmodule"); t.pass(); }); test.serial("created module package should build", async (t) => { t.timeout(120_000); - process.chdir(resolve(tmpdir(), "test-module")); - await shell("tsmodule build"); + await shell(`cd ${testModuleDir} && tsmodule build`); t.pass(); }); \ No newline at end of file