Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quibble doesn't throw when file can't be found #64

Closed
TimDaub opened this issue Apr 13, 2022 · 3 comments · May be fixed by #65
Closed

quibble doesn't throw when file can't be found #64

TimDaub opened this issue Apr 13, 2022 · 3 comments · May be fixed by #65

Comments

@TimDaub
Copy link
Contributor

TimDaub commented Apr 13, 2022

  • node v14.19.1
  • fantasy directoy exists
  • ./fantasy/fantasy.mjs doesn't exist
// index.mjs
import quibble from "quibble";

const run = async () => {
  await quibble.esm("./fantasy/fantasy.mjs");
};
run().catch(console.log).then(console.log);

when you run node index.mjs it just returns undefined. My expectation is that it should throw.

TimDaub added a commit to TimDaub/quibble that referenced this issue Apr 13, 2022
TimDaub added a commit to TimDaub/quibble that referenced this issue Apr 13, 2022
@searls
Copy link
Member

searls commented Apr 13, 2022

I don't think this is a bug. If you see this test of non-ESM, quibble has always supported faking non-existent paths

@TimDaub
Copy link
Contributor Author

TimDaub commented Apr 14, 2022

I found it quite confusing and it cost me some time only understanding that it wouldn't throw.

Maybe, would you be willing to allow the esm function to throw if a special input is passed. Or maybe a safeEsm function that always throws?

Otherwise, maybe making people more aware in the readme could help too.

@searls
Copy link
Member

searls commented Apr 14, 2022

I understand your point, but because this is a mature/stable/low-config library I would not support a new option for branching behavior like this. Happy to look at a PR that warns replacing paths to non-existent files is supported, however

@searls searls closed this as completed Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants