-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
'test is not defined' in Jest test files #3373
Comments
I determined that this issue is caused by the |
Ah, yes, that's very interesting. When the I'm afraid that I broke this, I did an optimization recently to lazy load the test module (which shaves quite some size from the main bundle). The unintended side effect is that the test globals (like I'm sorry for the sudden change, I hadn't thought of this use case. Would it be possible for you to change the I'm sorry for the inconvenience for this, hopefully we can find a proper workaround for this! |
@CompuIves Thank you for the response! It sounds like this isn't something that's going to be fixed, then, so I'll have to use the Do you anticipate that the main flow will have test globals available sometime soon? Is there an issue or pull request I can follow on that, or is it super far down the pipeline? |
In my opinion having tests in @SheaBelsky Out of curiosity, why did you set |
@lbogdan I'm the project lead for Awesome Learning, which is a learning platform for front-end technology and code. We have many lessons and courses, which use CodeSandbox's Git wizard to automatically populate a CodeSandbox based on the contents of a GitHub repo. Example: In these situations, we have students write unit tests to confirm their knowledge based on a particular subject. Until this was changed, we used the |
Makes sense! In this case, what you were / are doing is more like a workaround, but what you actually need is something along the lines of #514 , right? |
Closing this as we have #514 for allowing settings in Jest |
🐛 bug report
Description of the problem
When trying to open a file with Jest tests (where Jest is a dependency in
package.json
), CodeSandbox will show an error thattest
is not defined.How has this issue affected you? What are you trying to accomplish?
The opened CodeSandbox does not run tests as expected. As of a few days ago, this functionality worked fine. The expected behavior is that these tests run and fail, and users fix the tests as part of our educational site Awesome Learning.
Link to sandbox: https://codesandbox.io/s/github/wayfair/awesome-learning-exercises/tree/master/promises/intro-to-promises?fontsize=14
Your Environment
I can also reproduce this on https://codesandbox.io/s/github/wayfair/awesome-learning-exercises/tree/master/promises/advanced-promises?fontsize=14&previewwindow=tests. I noticed that the unit tests aren't running at all because
test
is undefined, even in a test environment.I think this is the same issue as #2311
The text was updated successfully, but these errors were encountered: