Skip to content

Commit

Permalink
chore: use shell cd over process.chdir to change directory, preve…
Browse files Browse the repository at this point in the history
…nt ava issues

see: avajs/ava#2945
  • Loading branch information
ctjlewis committed Feb 2, 2022
1 parent ebef2eb commit 6f5693a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions 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();
});

0 comments on commit 6f5693a

Please sign in to comment.