Files
bun.sh/test/js/bun/resolve/jsonc.test.ts
2024-09-03 21:32:52 -07:00

25 lines
765 B
TypeScript

import { expect, test } from "bun:test";
import { tempDirWithFiles } from "harness";
import { join } from "path";
test("empty jsonc - package.json", async () => {
const dir = tempDirWithFiles("jsonc", {
"package.json": ``,
"index.ts": `
import pkg from './package.json';
if (JSON.stringify(pkg) !== '{}') throw new Error('package.json should be empty');
`,
});
expect([join(dir, "index.ts")]).toRun();
});
test("empty jsonc - tsconfig.json", async () => {
const dir = tempDirWithFiles("jsonc", {
"tsconfig.json": ``,
"index.ts": `
import tsconfig from './tsconfig.json';
if (JSON.stringify(tsconfig) !== '{}') throw new Error('tsconfig.json should be empty');
`,
});
expect([join(dir, "index.ts")]).toRun();
});