-
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
Native Integration for Running Unit Tests in CodeSandbox #445
Conversation
👋 @CompuIves - as you mentioned here
could you help add |
packages/app/src/sandbox/compile.js
Outdated
}); | ||
|
||
debug(`Test Evaluation time: ${Date.now() - tt}ms`); | ||
dispatch({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CompuIves - the messages being dispatched from here do not seem to be showing up for me in the handleMessage
of Console/index.js
Great! I've added the globals 😄 . Implementation looks really good so far. |
@CompuIves - I've created a new
Next, I will look into why the dispatch results are not making their way to the Console. |
dispatching results to Console now works! |
This is sooo cool! I love how clean it is. Do you need help with the tab for the tests in the DevTools? I could work on that in the meantime if that makes sense. Also, do you have a test sandbox with test files? Would love to play with it a bit 😄 |
@CompuIves - Thank You! Here are 2 test sandboxes that you can try out: |
Maan this is so impressive! I'll try my hand at the tab, it would be great if every test result had 2 extra properties: a property with an array called something like |
@CompuIves - yes totally agree with grouping of tests using describe (right now i ignore |
@CompuIves - looks like all of the v1 functionality work for this is done. I will rebase this soon. When you merge this to master, will you also be releasing a new version of the site, or is that only going to happen with v2.5 later? If this is not going to be released immediately after merging, then I can create another PR later to add test cases for the test runner. In the meanwhile, let me know if you have any feedback on the code. |
It will be immediately released. I'll do a review now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks very good, clear and easy to read!
I left one question, also I think it's be best if the console.log
comments are removed before merging. Other than that I'm eager to merge this!
|
||
let summaryEmoji = | ||
aggregatedResults.totalTestSuites === aggregatedResults.passedTestSuites | ||
? '😎' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hahaha I love this
@@ -0,0 +1,210 @@ | |||
// @flow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, not sure. checking.
@@ -661,7 +663,8 @@ export default class TranspiledModule { | |||
this.source.compiledCode, | |||
require, | |||
this.compilation, | |||
manager.envVariables | |||
manager.envVariables, | |||
TestRunner.testGlobals() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
@CompuIves - i removed the console logs and that odd file. |
@CompuIves - what sort of documentation (if any for now) should I add. I can add Tests for this over the next few days if you are ok merging without them. |
It would be great to have documentation ready for the 25th, you can create docs here: /~https://github.com/CompuIves/codesandbox-client/blob/master/packages/homepage/content/docs/. In the meantime we can merge it in 😄 . Thank you very much for this immense help. This is a very big feature to have! |
- Added support for nested describes - Added summary messages for test runs - Log failing tests with file path - Added support for finding tests in __tests__ -
Hmm, something strange happens with the jest test, I'm not sure why... |
* upstream/master: Fix test Native Integration for Running Unit Tests in CodeSandbox (codesandbox#445)
What kind of change does this PR introduce?
This PR adds native integration of unit testing using jest packages as discussed in this issue
What is the current behavior?
Currently, there is no support for unit testing.
What is the new behavior?
For a project with unit tests, Code Sandbox will run those tests and show the results in a new Tests tab (next to the Console tab)
Feature Checklist (v1):
Checklist: