aboutsummaryrefslogtreecommitdiff
path: root/test/cli/run/run-process-env.test.ts
blob: 8d8eb0b07aad01c9deb27c78fd9ca38964801d64 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { describe, expect, test } from "bun:test";
import { bunRunAsScript, tempDirWithFiles } from "harness";

describe("process.env", () => {
  test("npm_lifecycle_event", () => {
    const scriptName = "start:dev";

    const dir = tempDirWithFiles("processenv", {
      "package.json": `{'scripts': {'${scriptName}': 'bun run index.ts'}}`,
      "index.ts": "console.log(process.env.npm_lifecycle_event);",
    });

    const { stdout } = bunRunAsScript(dir, scriptName);
    expect(stdout).toBe(scriptName);
  });
});