Skip to content
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

incompatibile with ember-exam? #97

Open
SergeAstapov opened this issue Jun 27, 2019 · 4 comments
Open

incompatibile with ember-exam? #97

SergeAstapov opened this issue Jun 27, 2019 · 4 comments
Labels

Comments

@SergeAstapov
Copy link
Collaborator

SergeAstapov commented Jun 27, 2019

Hi there!

First of all - thank you for great addon!

I'm not sure it's necessarily a defect, maybe just "how things work". If my assumptions are correct - maybe worth to add this as a note somewhere in docs.

We use ember-exam to parallelize tests sugar following command:

ember exam --split=4 --parallel=1

As we started to write more fastBoot tests, they started to flow into different partitions.
At the same time what we observed is that FastBoot tests sporadically fail.

My assumption is:
when tests run, ember-cli-fastboot-testing creates instance of testemMiddleware (here).

As we parallelize tests and run them in 4 browser instances at the same time, FastBoot tests may be split between different browser instances.
After every test run afterEach hook calls /__cleanup-mocks url (from here, defined here).

Due to multiple threads of test runners but single instance of testemMiddleware - mocks may be cleaned up while some other test is running, which may cause tests to fail sporadically (execution order and execution timing in not guarantied when we have 4 browser instances running in parallel).

Please share your thoughts on this.

As a mitigation, we changed test command to following:

ember exam --split=4 --parallel=1 --filter='!Fastboot |' && ember test --filter='Fastboot |'
@ryanto ryanto added the bug label Jun 27, 2019
@ryanto
Copy link
Member

ryanto commented Jun 27, 2019

Yup, absolutely a bug! Thanks for the great write up, that made it easy to understand.

Also thanks for posting your fix, hopefully that will help anyone else facing this for the time being.

My guess is that we should have beforeEach setup a guid that creating and cleaning up mocks can use. This way cleanup only clears out mocks that were created during its test run.

@SergeAstapov
Copy link
Collaborator Author

@ryanto Thank you for quick response!

looks like nock supports "scopes" - https://github.com/nock/nock#scope-filtering, may be an option here

@suchitadoshi1987
Copy link

@ryanto did we come up with a solution for this issue? looks like we are seeing a similar issue which potentially might be caused due to this.

@ryanto
Copy link
Member

ryanto commented Nov 13, 2019

Hi @suchitadoshi1987

Right now the best thing to do is the test filtering based on Serge's post so that you only run a single fastboot testing process.

ember exam --split=4 --parallel=1 --filter='!Fastboot |' && ember test --filter='Fastboot |'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants