diff --git a/package.json b/package.json index 5cd8a6ed..ea1af62c 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "lint": "eslint --ext .ts,.js . && prettier -c src lib test stubs", "lint:fix": "eslint --fix --ext .ts,.js . && prettier -w src lib test stubs", "release": "pnpm build && pnpm test && changelogen --release --push && npm publish", - "test": "pnpm lint && vitest run --coverage", - "test:bun": "JITI_DEBUG=1 bun --bun test/bun/index.ts" + "test": "pnpm lint && vitest run --coverage && pnpm test:bun", + "test:bun": "bun --bun test test/bun" }, "devDependencies": { "@babel/core": "^7.22.10", diff --git a/test/bun/fixtures.ts b/test/bun/fixtures.ts deleted file mode 100644 index 63aa0a89..00000000 --- a/test/bun/fixtures.ts +++ /dev/null @@ -1,16 +0,0 @@ -import "../fixtures/async"; -import "../fixtures/circular"; -import "../fixtures/env"; // Known Issues -- Fallbacks to Jiti -// import "../fixtures/error-parse"; // Error expected -// import "../fixtures/error-runtime"; // Error expected -import "../fixtures/esm"; -import "../fixtures/exotic"; -import "../fixtures/hashbang"; -import "../fixtures/import-map"; -import "../fixtures/json"; -import "../fixtures/mixed"; -import "../fixtures/native"; -import "../fixtures/proto"; -import "../fixtures/pure-esm-dep"; -import "../fixtures/syntax"; -// import "../fixtures/typescript"; // Known Issues diff --git a/test/bun/index.test.ts b/test/bun/index.test.ts new file mode 100644 index 00000000..8cab3d31 --- /dev/null +++ b/test/bun/index.test.ts @@ -0,0 +1,21 @@ +import { fileURLToPath } from "url"; +import { readdirSync } from "node:fs"; +// @ts-ignore +import { test } from "bun:test"; + +import jiti from "../../lib/index.js"; + +const fixturesDir = fileURLToPath(new URL("../fixtures", import.meta.url)); + +const fixtures = readdirSync(fixturesDir); + +const _jiti = jiti(fixturesDir, { debug: true }); + +for (const fixture of fixtures) { + if (fixture.startsWith("error-")) { + continue; + } + test("fixtures/" + fixture, () => { + _jiti("./" + fixture); + }); +} diff --git a/test/bun/index.ts b/test/bun/index.ts deleted file mode 100644 index 4dd588ed..00000000 --- a/test/bun/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import jiti from "../../lib/index"; - -const _jiti = jiti(import.meta.url, {}); - -// Jiti should bypass it's logic and prefer bun -_jiti("./fixtures.ts"); - -// Use bun directly -// require("./fixtures.ts"); diff --git a/vitest.config.ts b/vitest.config.ts index a48bc469..001ca09a 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -2,6 +2,6 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ test: { - exclude: ["**/test.{ts,mjs,cjs,js}", "node_modules/**/*"], + exclude: ["**/test.{ts,mjs,cjs,js}", "node_modules/**/*", "test/bun"], }, });