Skip to content

replace mocha with jest #1650

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 3 commits into from
Feb 6, 2019
Merged

replace mocha with jest #1650

merged 3 commits into from
Feb 6, 2019

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Feb 5, 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?

Motivation / Use-Case

#1649 (comment)

Breaking Changes

Additional Info

Currently, since duplication of ports occurred, the test is executed in series.
I would like to correspond with another PR.
If all CIs pass, remove wip.

@@ -31,7 +31,7 @@ function runWebackDevServer(testArgs, configPath) {
const args = [webpackDevServerPath, '--config', configPath].concat(testArgs);

return new Promise((resolve, reject) => {
const child = spawn('node', args, { cwd, env });
const child = execa('node', args, { cwd, env });
Copy link
Member Author

Choose a reason for hiding this comment

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

It is strange to use spawn, the following error occurs.

 spawn node ENOENT

So We will use execa.

@alexander-akait
Copy link
Member

Good job, let's wait CI green 👍

@codecov
Copy link

codecov bot commented Feb 5, 2019

Codecov Report

Merging #1650 into master will increase coverage by 7.29%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1650      +/-   ##
==========================================
+ Coverage   75.14%   82.43%   +7.29%     
==========================================
  Files          10       15       +5     
  Lines         688      484     -204     
  Branches        0      120     +120     
==========================================
- Hits          517      399     -118     
+ Misses        171       68     -103     
- Partials        0       17      +17
Impacted Files Coverage Δ
setupTest.js 100% <100%> (ø)
test/helpers/run-webpack-dev-server.js 92.59% <100%> (ø)
lib/utils/createCertificate.js 66.66% <0%> (-33.34%) ⬇️
lib/Server.js 78.9% <0%> (-2.61%) ⬇️
bin/options.js
bin/webpack-dev-server.js
examples/cli/public/webpack.config.js
bin/utils.js
examples/util.js
... and 9 more

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 102941f...10e4bc2. Read the comment docs.

@alexander-akait
Copy link
Member

@hiroppy hm, coverage is very decrease, something wrong?

@hiroppy
Copy link
Member Author

hiroppy commented Feb 5, 2019

hmmm.... I don't know that. Current setting is "collectCoverageFrom": ["(lib|bin)/**/*.js"],.

@hiroppy
Copy link
Member Author

hiroppy commented Feb 5, 2019

Test failed on appveyor.(Environment: nodejs_version=8, webpack_version=latest)

FAIL test/Routes.test.js
  ● Routes › headers as an array › GET request with headers as an array
    expected "X-Bar" of "key1=value1, key2=value2", got "key1=value1,key2=value2"
      at Test.Object.<anonymous>.Test._assertHeader (node_modules/supertest/lib/test.js:249:12)
      at Test.Object.<anonymous>.Test._assertFunction (node_modules/supertest/lib/test.js:283:11)
      at Test.Object.<anonymous>.Test.assert (node_modules/supertest/lib/test.js:173:18)
      at Server.assert (node_modules/supertest/lib/test.js:131:12)

@hiroppy
Copy link
Member Author

hiroppy commented Feb 5, 2019

@hiroppy
Copy link
Member Author

hiroppy commented Feb 5, 2019

The following error occurs only at Node 8 🤔(it also happened on my mac)

 expected "X-Bar" of "key1=value1, key2=value2", got "key1=value1,key2=value2"

@hiroppy
Copy link
Member Author

hiroppy commented Feb 6, 2019

@evilebottnawi Since I do not know the cause, I temporarily verified it.
I think that it is not good, but I think that the influence range is not so big either.(Because the core code is not rewritten)
29b320d

@hiroppy hiroppy changed the title [WIP] replace mocha with jest replace mocha with jest Feb 6, 2019
const expected =
process.version.split('.')[0] === 'v8'
? 'key1=value1,key2=value2'
: 'key1=value1, key2=value2';
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just remove spaces from expected? I am afraid another version can also have same problem?

Copy link
Member Author

@hiroppy hiroppy Feb 6, 2019

Choose a reason for hiding this comment

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

version output spaces
6 key1=value1, key2=value2 y
7 key1=value1,key2=value2 n
8 key1=value1,key2=value2 n
9 key1=value1,key2=value2 n
10 key1=value1, key2=value2 y
11 key1=value1, key2=value2 y

6, 10, 11 have the spaces but 7, 8, 9 don't have.

So, I change the code to ['v7', 'v8', 'v9'].includes.

Copy link
Member

Choose a reason for hiding this comment

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

@hiroppy Can you send this change in commit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Separated this commit(10e4bc2) /cc @evilebottnawi

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.

Great job! One note

@alexander-akait
Copy link
Member

@hiroppy Good job, let's wait CI green

@hiroppy
Copy link
Member Author

hiroppy commented Feb 6, 2019

@evilebottnawi Thanks for reviewing! CI is green:)

@alexander-akait alexander-akait merged commit 5833986 into webpack:master Feb 6, 2019
@hiroppy hiroppy deleted the feature/jest branch February 6, 2019 13:28
@alexander-akait
Copy link
Member

@hiroppy let's improve CI testing

https://github.com/webpack/webpack-dev-server/blob/master/.travis.yml (need add 8 and 11)

https://github.com/webpack/webpack-dev-server/blob/master/appveyor.yml (need add node 11)

Maybe refactor and improve config (add cache)

Can you take care?

@hiroppy
Copy link
Member Author

hiroppy commented Feb 6, 2019

Yep, I'll work on that:)

yoshinorin added a commit to yoshinorin/webpack-dev-server that referenced this pull request Jun 4, 2019
hiroppy pushed a commit that referenced this pull request Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants