-
Notifications
You must be signed in to change notification settings - Fork 522
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
Verify early that test files actually define the corresponding named modules #1867
Comments
#1872 is a "wonderful" example of the confusion that arises when people try to debug these issues. A better error would really be appreciated! |
+1 This caused me much wasted time. |
Alternatively, instead of assuming that test files create certain modules, one could use this (semi-public) requirejs api to learn which modules are defined and issue the respective 'require' calls. |
This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs! |
+1 This caused us much wasted time. |
Sorry everyone - since karma_web_test is no longer in this repo, I'm closing the issue. |
#1308 # Relevant Rules
karma_web_test
Description
The scripts generated by karma_web_test loadFile()s all the files and then require()s them as modules:
The unstated assumption is that ..._test.js actually defines a named module '..._test' . If that assumption doesn't hold the errors are really hard to grasp for a newbie, namely
'no timestamp' warnings, 404s in the web server (since the module name doesn't even map to the right url) and a 30s timeout (since we never reach karma.start).
I did not find this documented anywhere and the mechanism in the examples/ is also fairly obscure:
To reproduce, try to use an empty .js file as "src" of a karma_web_test rule.
Describe the solution you'd like
The requirements for the contents of test files should be documented more clearly.
Also, after/as part of each loadFile, karma_web_test should check that the file indeed defined the right named module and abort early with a useful error message.
Describe alternatives you've considered
Maybe even a build-time check on the test files whether they're named modules?
The text was updated successfully, but these errors were encountered: