mirror of
https://github.com/hanzoai/trace-js.git
synced 2026-10-30 18:19:26 +00:00
31 lines
973 B
TypeScript
31 lines
973 B
TypeScript
import { spawnSync } from "child_process";
|
|
import { join } from "path";
|
|
|
|
describe("Test Different Module Conventions", () => {
|
|
it.each([["test:cjs"], ["test:mjs"], ["test:ts-nodenext"], ["test:ts-cjs"]])(
|
|
"should correctly execute %s",
|
|
(testCommand) => {
|
|
const result = spawnSync("npm", ["run", testCommand], {
|
|
cwd: join(__dirname, "modules"),
|
|
encoding: "utf-8",
|
|
env: process.env,
|
|
});
|
|
console.log(result.output);
|
|
console.log(result.stdout);
|
|
console.log(result.stderr);
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toContain("Did construct objects and called them.");
|
|
expect(result.status).toBe(0);
|
|
}
|
|
);
|
|
|
|
it.each([["test:tsc-nodenext"], ["test:tsc-cjs"]])("should typecheck %s", (testCommand) => {
|
|
const result = spawnSync("npm", ["run", testCommand], {
|
|
cwd: join(__dirname, "modules"),
|
|
encoding: "utf-8",
|
|
});
|
|
|
|
expect(result.status).toBe(0);
|
|
});
|
|
});
|