From 6f5693ab3a3d6d89be692071ed58a4595d600d47 Mon Sep 17 00:00:00 2001 From: "C. Lewis" Date: Wed, 2 Feb 2022 14:23:15 -0600 Subject: [PATCH] chore: use shell `cd` over `process.chdir` to change directory, prevent ava issues see: https://github.com/avajs/ava/issues/2945 --- test/integration/commands/create.test.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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