-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Better error message if file is missing #221
Comments
Please send PR |
Hi @ai, i could not get the tests running on my machine for the current main branch, so I can't change and push anything. My PR would look like: file: let writeFile = promisify(fs.writeFile)
+let readFile = promisify(fs.readFile)
const STATIC = /\.(eot|woff2?|ttf|otf|svg|png|jpe?g|gif|webp|mp4|mp3|ogg|pdf|html|ico|md)$/
+async function checkIfFilesExist(limitConfig, check) {
+ const filesToCheck = []
+ for (const file of check.files) {
+ filesToCheck.push(file)
+ }
+ if (check.path) {
+ filesToCheck.push(join(limitConfig.cwd, check.path))
+ }
+
+ for (const file of filesToCheck) {
+ await readFile(file)
+ .catch(() => { throw Error(`Could not test '${check.name}' because file '${file}' is missing`) })
+ }
+}
+
module.exports = async function getConfig(limitConfig, check, output) {
+ await checkIfFilesExist(limitConfig, check)
+
if (check.import) { |
|
fixe: Better error message if file is missing ai#221
I now have disabled all git-hooks locally to be able to push to this repository. |
What error did you have? |
I get o lot of different errors:
|
Better error message if file is missing ai#221
Better error message if file is missing ai#221
Better error message if file is missing ai#221
It took me a while to realize what was wrong: the file I tried to test was missing, because I forgot to build my library before I ran
npm size-limit
.I got following error message:
It would be a nice UX improvements when the error could be catched and a "human-readable" error message would be displayed instead. Something like: "Could not test
{{name}}
because file '{{path}}' is missing"used package-versions:
The text was updated successfully, but these errors were encountered: