Files
bun.sh/test/js/bun/resolve/resolve-bad-parent.test.mjs
2025-03-20 00:53:46 -07:00

18 lines
654 B
JavaScript

//! These tests are targetting an assertion failure, but that mistake indicates a mistake
//! in the module resolver, which is that it should not query the file system in a relative
//! manner when the referrer is not a filesystem path.
test("you can't crash the resolver with import.meta.resolve/Sync", () => {
expect(() => {
console.log(import.meta.resolveSync("#foo", "file:/Users/chloe"));
}).toThrow();
expect(() => {
console.log(import.meta.resolve("#foo", "file:/Users/chloe"));
}).toThrow();
});
// TODO(@paperclover): ensure this crash isn't possible.
test.todo("you can't crash the resolver with Bun.plugin", () => {
//
});