diff options
author | 2023-03-12 06:43:32 -0400 | |
---|---|---|
committer | 2023-03-12 03:43:32 -0700 | |
commit | 21f9fc828f9b115f2d0db5da025394e4aee9530e (patch) | |
tree | c16c95a255837703fc80ed1a916d16b01cf4c5dc /test/js | |
parent | 8c91278a00edf6774148c7b41871d1f999cdb0e1 (diff) | |
download | bun-21f9fc828f9b115f2d0db5da025394e4aee9530e.tar.gz bun-21f9fc828f9b115f2d0db5da025394e4aee9530e.tar.zst bun-21f9fc828f9b115f2d0db5da025394e4aee9530e.zip |
fix `require.resolve` with an empty options object #2370 (#2371)
* fix #2370 and import-meta test
* edit test to not allow transpiler optimization
Diffstat (limited to 'test/js')
-rw-r--r-- | test/js/bun/resolve/import-meta.test.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/js/bun/resolve/import-meta.test.js b/test/js/bun/resolve/import-meta.test.js index f87c8f89f..a95b1a0ea 100644 --- a/test/js/bun/resolve/import-meta.test.js +++ b/test/js/bun/resolve/import-meta.test.js @@ -1,7 +1,7 @@ import { it, expect } from "bun:test"; import { mkdirSync, rmSync, writeFileSync } from "node:fs"; import * as Module from "node:module"; -import sync from "./require-json.json.js"; +import sync from "./require-json.json"; const { path, dir } = import.meta; @@ -50,7 +50,7 @@ it("require with a query string works on dynamically created content", () => { it("import.meta.require (json)", () => { expect(import.meta.require("./require-json.json").hello).toBe(sync.hello); const require = Module.createRequire(import.meta.path); - expect(require("./require-json.json.js").hello).toBe(sync.hello); + expect(require("./require-json").hello).toBe(sync.hello); }); it("const f = require;require(json)", () => { @@ -162,3 +162,7 @@ it('require("bun") works', () => { it('import("bun") works', async () => { expect(await import("bun")).toBe(Bun); }); + +it("require.resolve with empty options object", () => { + expect(require.resolve(import.meta.path + String(""), {})).toBe(import.meta.path); +}); |