feat: run parallel tests with different test contexts
See original GitHub issueI’d love to be able to initialise setupTest several times in the same file or even across files in the test suite.
E.g. do something like this
import { setupTest, createPage, cleanup } from '@nuxtjs/module-test-utils'
describe('module with default options', () => {
  setupTest({
    __dirname,
    browser: true,
    fixture: '../example',
  })
  test('My test', async () => {
    // ...
  })
})
describe('module with other options', () => {
  setupTest({
    __dirname,
    browser: true,
    fixture: '../example',
    config: differentOptions,
  })
  test('My test', async () => {
    // ...
  })
})
If I do this, I get non-determinative behaviour - or errors - even if the test is setup only once in each test spec file. (That is, options leak from one test context into another.) Or (if I pass different config objects in different files), I get:
 TypeError: Cannot read property 'moduleContainer' of undefined
   at node_modules/@nuxtjs/module-test-utils/dist/index.js:286:29
   at fulfilled (node_modules/tslib/tslib.js:112:62)
Issue Analytics
- State:
 - Created 3 years ago
 - Reactions:1
 - Comments:7 (7 by maintainers)
 
Top Results From Across the Web
Revving up Continuous Integration with Parallel Testing
Our starting definition may look deceptively simple: we say we're performing parallel testing when two or more tests are run simultaneously.
Read more >tun unit tests in parallel and other test sequentially in the ...
i am having an issue to understand how can i run all the unit tests in my boot spring application(kotlin) ...
Read more >How to run Jest tests sequentially
The --runInBand or -i option of the Jest CLI allows you to run tests sequentially (in non-parallel mode). The final command will look...
Read more >Run VSTest tests in parallel - Azure Pipelines
Continuous testing. Speed up testing by running tests in parallel using Visual Studio Test task.
Read more >Choosing a Test Runner
When using these runners, Test Environment will create an independent local blockchain for each parallel run, so there is zero risk of your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@danielroe #49 would be perfect if all internals can be instructed to use mock mfs. random build dir is also nice idea for a shorter term. Something else that would be awesome is if we can do snapshot builds similar to new nuxt generate to avoid unnecessary rebuilds when running tests multiple times. We may also introduce a lock-file to fix multi build conflict.
Also, issue with multiple describes in single file should be fixed by #51 (2.0.0-2) 😃
There is no shared context between multiple files no matter keeping context in test file or an imported library each test file is sandboxed in a worker. The reason multiple setup files are failing is mostly because the setup is also doing a nuxt build which because two runnin in parallel, conflicting on fs level (buildDir)