mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
* umask * process args * update reportError.test.ts * file exists * transpiler cache * back to const * remove failing comments * [autofix.ci] apply automated fixes * update comment * debug assert and remmove branch * oops * escape * path sep * seekTo * disable --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { bunExe, bunRunAsScript, tempDirWithFiles } from "harness";
|
|
|
|
describe("process.env", () => {
|
|
test("npm_lifecycle_event", () => {
|
|
const scriptName = "start:dev";
|
|
|
|
const dir = tempDirWithFiles("processenv", {
|
|
"package.json": JSON.stringify({ "scripts": { [`${scriptName}`]: `${bunExe()} run index.ts` } }),
|
|
"index.ts": "console.log(process.env.npm_lifecycle_event);",
|
|
});
|
|
|
|
const { stdout } = bunRunAsScript(dir, scriptName);
|
|
expect(stdout).toBe(scriptName);
|
|
});
|
|
|
|
// https://github.com/oven-sh/bun/issues/3589
|
|
test("npm_lifecycle_event should have the value of the last call", () => {
|
|
const dir = tempDirWithFiles("processenv_ls_call", {
|
|
"package.json": JSON.stringify({ scripts: { first: `${bunExe()} run --cwd lsc second` } }),
|
|
"lsc": {
|
|
"package.json": JSON.stringify({ scripts: { second: `${bunExe()} run index.ts` } }),
|
|
"index.ts": "console.log(process.env.npm_lifecycle_event);",
|
|
},
|
|
});
|
|
|
|
const { stdout } = bunRunAsScript(dir, "first");
|
|
expect(stdout).toBe("second");
|
|
});
|
|
});
|