-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix(server): error on unknown filetypes #3601
Conversation
BREAKING CHANGE: Previously file types that were not given in the config and could not be determined from the file extension were treated as .js. That can lead to loading extra or incorrect files. Now we emit an ERROR and skip any files that cannot be classified.
✅ Build karma 2816 completed (commit 0868013829 by @johnjbarton) |
✅ Build karma 419 completed (commit 0868013829 by @johnjbarton) |
✅ Build karma 418 completed (commit 0868013829 by @johnjbarton) |
I don't think this is a good change. It results in worse developer experience. Compare "My tests crashed. I check Karma logs and understand why. I see message explaining that my files have incorrect type." before vs. "My tests silently passed, but some of them were not run and I didn't noticed as I never checked Karma logs." with this change. So when users upgrade to Karma 6, some tests may stop running, but it is hard to notice (in particular in CI environment, where it will be just a line in logs, not a failed test run). And for other part of users tests will start crashing because of missing files for no good reason creating annoyance. If we want to make something in this area it should probably happen up the stack (during config validation or when we create |
Ah, so your theory is that some of the incorrect file types are actually things needed for tests to pass? |
How will a warning in the config file differ from the warning now? Yes, it is better to validate in the config file analysis phase, but will users pay any more attention? Seems like the other option is to fail these cases outright: you have to pass correct file name or correct file types. Is there a use case for the current silently-treat-as-js ? |
Yeah, exactly! I would expect some people to just ignore the warning right now as it's just a warning and rely on the fallback to JS. I can think of case like
I agree that this feature will also catch valid errors as you say (e.g. .wav, .jpg, etc) and it is useful to notify user about such cases. But I think that we should be loud about such cases and fail (not just print into logs). So, yeah, I'm for failing outright with the transition period to not affect existing users relying on the fallback.
See above for .cjs, .mjs, extension-less URLs (for example https://unpkg.com/jquery will redirect to the JS file, but it does not have .js in the URL). IMO it is reasonable to ask users to specify |
BREAKING CHANGE:
Previously file types that were not given in the config and could not be
determined from the file extension were treated as .js. That can lead
to loading extra or incorrect files.
Now we emit an ERROR and skip any files that cannot be classified.