Skip to content

test: don't use --runInBand and improve execution performance #2005

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

Merged
merged 1 commit into from
Jun 10, 2019

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Jun 10, 2019

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

modify only

Motivation / Use-Case

Currently, the test's execution performance is too slow because we select serial execution.

Project: https://github.com/webpack/webpack-dev-server/projects/1#card-22555681

In this pr, we can use parallel execution.

Result

serial execution
Test Suites: 1 skipped, 49 passed, 49 of 50 total
Tests:       9 skipped, 419 passed, 428 total
Snapshots:   152 passed, 152 total
Time:        113.313s, estimated 173s
Ran all test suites.
parallel execution
Test Suites: 1 skipped, 49 passed, 49 of 50 total
Tests:       9 skipped, 419 passed, 428 total
Snapshots:   152 passed, 152 total
Time:        60.5s
Ran all test suites.

Strategy

Set the number of ports of each test

see https://github.com/webpack/webpack-dev-server/blob/feature/modify-jest/test/ports-map.js

The key is a file name and the value is the number of ports. We make it easy to change the number of ports flexibly.

globalSetup

see https://github.com/webpack/webpack-dev-server/blob/feature/modify-jest/globalSetupTest.js

We'll use many ports for parallel execution, so we have to make sure that all ports used at boot time are free.

Tests
const [port1, port2] = require('../ports-map')['file-name'];

Breaking Changes

no

Additional Info

NOTE: this pr targets #1996, not next

@hiroppy hiroppy requested a review from alexander-akait as a code owner June 10, 2019 00:31
@hiroppy hiroppy mentioned this pull request Jun 10, 2019
6 tasks
@codecov
Copy link

codecov bot commented Jun 10, 2019

Codecov Report

Merging #2005 into feature/refactor-tests will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@                  Coverage Diff                   @@
##           feature/refactor-tests   #2005   +/-   ##
======================================================
  Coverage                    92.4%   92.4%           
======================================================
  Files                          28      28           
  Lines                        1067    1067           
  Branches                      324     324           
======================================================
  Hits                          986     986           
  Misses                         77      77           
  Partials                        4       4

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e0c340...35405a7. Read the comment docs.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Let's merge this in master, we will support webpack-dev-server@3 some time after release 4 version so to avoid problem with merge and releases better refactor tests in master

@hiroppy
Copy link
Member Author

hiroppy commented Jun 10, 2019

@evilebottnawi I want to merge this to next branch. And I'll create a backport pr to master branch because this change has many conflicts between next and master. anyway, I cannot avoid resolving conflicts.

@alexander-akait
Copy link
Member

@hiroppy 👍

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge when CI green

@hiroppy hiroppy merged commit 50a9bb0 into feature/refactor-tests Jun 10, 2019
@hiroppy hiroppy deleted the feature/modify-jest branch June 10, 2019 12:56
hiroppy added a commit that referenced this pull request Jun 10, 2019
hiroppy added a commit that referenced this pull request Jun 10, 2019
hiroppy added a commit that referenced this pull request Jun 10, 2019
@hiroppy hiroppy mentioned this pull request Jun 10, 2019
6 tasks
hiroppy added a commit that referenced this pull request Jun 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants