-
Notifications
You must be signed in to change notification settings - Fork 19
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
RFC: Test runner integration #14
Comments
I did a quick prototype. As I was suspecting, during require phase mocha is not yet fully initialized but you can just wait till it is :-> This works: (I am not sure if it's reliable) async function main() {
// sync setup like discovering and loading plugins
// we need to delay execution after mocha finishes initialization
await Promise.resolve()
beforeEach(function(){
console.log("Setting earl!")
console.log(this.currentTest)
})
}
main() and it's super easy to configure with
|
Mocha's team works on "Root Hook Plugins", this would allow earl to work in parallel mode in mocha: |
Basic implementation was just merged. I realized that it needs a little bit more work to properly support mocks created outside of "it" block. |
Test runner integration (
beforeEach
/afterEach
) /should be implemented to avoid repetition and hard to spot bugs. I propose to not worry about parallel test execution at this stage.What should happen during integration?
Autoload all earl plugins (with external matchers).
After each test:
Before each test:
earl.setContext({name: "testSuite/testName"})
That would allow implementation of snapshots without a need to provide a name for it (same interface as jest). I don't want to dive into this now since I am not sure if we want to implement snapshots at all 🤔How integration should look like
Perfectly it would be as simple as
-r earl/integrate-mocha
but I am not sure if this can be done like this or we need to force users to add somewhere in there test suite snippet like:I think earl should ship with integrations for most popular test runners (at least for mocha).
The text was updated successfully, but these errors were encountered: