-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow importing
bun.lock
(+ types for it) (#16244)
Co-authored-by: RiskyMH <[email protected]>
- Loading branch information
Showing
7 changed files
with
142 additions
and
11 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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { expect, test } from "bun:test"; | ||
import { tempDirWithFiles } from "harness"; | ||
import { join } from "path"; | ||
|
||
const lockfile = `{ | ||
"lockfileVersion": 0, | ||
"workspaces": { | ||
"": { | ||
"name": "something", | ||
"dependencies": { }, | ||
}, | ||
}, | ||
"packages": { }, | ||
}`; | ||
|
||
test("import bun.lock file as json", async () => { | ||
const dir = tempDirWithFiles("bun-lock", { | ||
"bun.lock": lockfile, | ||
"index.ts": ` | ||
import lockfile from './bun.lock'; | ||
const _lockfile = ${lockfile} | ||
if (!Bun.deepEquals(lockfile, _lockfile)) throw new Error('bun.lock wasnt imported as jsonc'); | ||
`, | ||
}); | ||
|
||
expect([join(dir, "index.ts")]).toRun(); | ||
}); |
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