Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use shell
cd
over process.chdir
to change directory, preve…
…nt ava issues see: avajs/ava#2945
- Loading branch information
Showing
1 changed file
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}); |