-
Notifications
You must be signed in to change notification settings - Fork 46
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
Extend NodeEnvironment to avoid side effect methods #62
Comments
@NimaSoroush do you want differencify to act as a Jest plugin, which is what jest-puppeteer-example is trying to do. If so, then it won't support other test frameworks. |
@xfumihiro : Differencify is independent to test framework and it could be integrated with any test runner, but my goal is to optimise for Jest. As you can see I've added special functionalities for Jest like |
AFAIK Jest handles test suite runtimes differently than others so I had to make these PRs |
@xfumihiro : I like the idea of splitting Differencify into core & adapters 👍
or
That should be enough. right? |
@NimaSoroush If you want to launch/close puppeteer once upon all test suites in Jest, you should do that inside Global setup/teardown scripts (not inside test environments as I've explained here) |
Hi @NimaSoroush I'm Qing, I found out the cause of the issue I reported to you earlier over slack: when Differencify is instantiated in a sub class of NodeEnvironment, it can't access One thing I don't understand is that even though |
Hi @yq314 , That is interesting! Is there anything else we can use in NodeEnvironment that would help us with detecting the Jest environment? |
@NimaSoroush when it's running in NodeEnvironment or its subclass would indicate that it's already running in jest environment? So we could always set |
Yep, but we need an automated way of detecting the environment! another way to tackle this would be to introduce an aditional flag that could manually tell differencify is running on Jest
|
That's a good idea indeed! |
Do you mind adding a PR for that? |
I'd love too, but I want to get clarification on something first. As pointed out here #62 (comment) we should do possible to make Similar to puppeteer:
It would be easier if we have:
And in this case we wouldn't need a NodeEnvironment, so the manual setting of |
I have never tried that but that seems to be possible but needs a little bit of extra work. I know puppeteer provides a way of pointing to chrome instance path through |
Based on jest-puppeteer-example it would be great to extend
NodeEnvironment
similar to thisfor example, this will avoid
differencify.launchBrowser()
anddifferencify.cleanup()
on this example@xfumihiro: Anything to add?
The text was updated successfully, but these errors were encountered: