node-assets.test.ts 681 B

1234567891011121314151617
  1. import { expect, test } from "bun:test"
  2. import { fileURLToPath } from "node:url"
  3. import { collectNodeAssets } from "../script/node-assets"
  4. import { nodeTarget, shellParserWasmAssets } from "../src/node/target"
  5. test("collects each SEA asset key once", async () => {
  6. const assets = await collectNodeAssets(nodeTarget(process.platform, process.arch))
  7. const keys = assets.map((asset) => asset.key)
  8. expect(new Set(keys).size).toBe(keys.length)
  9. expect(assets.filter((asset) => asset.key === shellParserWasmAssets.runtime)).toEqual([
  10. {
  11. key: shellParserWasmAssets.runtime,
  12. source: fileURLToPath(import.meta.resolve(shellParserWasmAssets.runtime)),
  13. },
  14. ])
  15. })