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

feat(progess): emit progress-update #2498

Merged
merged 1 commit into from
Apr 3, 2020
Merged

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Apr 3, 2020

closes: #1666

  • 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?

yes

Motivation / Use-Case

Emit progress-update event.

Breaking Changes

no

Additional Info

@@ -31,11 +31,13 @@ module.exports = class WebsocketServer extends BaseServer {
const noop = () => {};

setInterval(() => {
this.wsServer.clients.forEach((ws) => {
if (ws.isAlive === false) return ws.terminate();
this.wsServer.clients.forEach((socket) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

fixed by eslint

@codecov
Copy link

codecov bot commented Apr 3, 2020

Codecov Report

Merging #2498 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2498      +/-   ##
==========================================
+ Coverage   93.57%   93.58%   +0.01%     
==========================================
  Files          34       34              
  Lines        1322     1325       +3     
  Branches      380      381       +1     
==========================================
+ Hits         1237     1240       +3     
  Misses         83       83              
  Partials        2        2              
Impacted Files Coverage Δ
lib/Server.js 96.78% <100.00%> (+0.01%) ⬆️
lib/servers/WebsocketServer.js 94.11% <100.00%> (+0.17%) ⬆️

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 adeb92e...d73e138. Read the comment docs.


if (this.listeningApp) {
this.listeningApp.emit('progress-update', { percent, msg });
}
Copy link
Member

Choose a reason for hiding this comment

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

Why we need check this.listeningApp? Is can be undefined?

Copy link
Member Author

@hiroppy hiroppy Apr 3, 2020

Choose a reason for hiding this comment

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

We need this condition because this.setupProgressPlugin is called before this.createServer.

。◕ˇ_ˇ◕。 ~/p/w/webpack-dev-server (feature/emit-progress-update| 🎃 1 📦 1)  ᐅ npm run test:only -- progress-option

> [email protected] test:only /Users/hiroppy/programming/webpack/webpack-dev-server
> jest --forceExit "progress-option"

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        3.755s
Ran all test suites matching /progress-option/i.
Force exiting Jest: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:only: `jest --forceExit "progress-option"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test:only script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hiroppy/.npm/_logs/2020-04-03T10_59_27_800Z-debug.log
> npm run test:only -- progress-option

> [email protected] test:only /Users/hiroppy/programming/webpack/webpack-dev-server
> jest --forceExit "progress-option"

  console.info node_modules/webpack-log/src/loglevel/PrefixFactory.
js:55
    ℹ 「wds」: Project is running at http://localhost:8134/

  console.info node_modules/webpack-log/src/loglevel/PrefixFactory.js:55
    ℹ 「wds」: webpack output is served from undefined

  console.info node_modules/webpack-log/src/loglevel/PrefixFactory.js:55
    ℹ 「wds」: Content not from webpack is served from /Users/hiroppy/programming/webpack/webpack-dev-server

 PASS  test/server/progress-option.test.js
  progress
    output
      ✓ should show percentage progress without profile data (570ms
)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        2.107s
Ran all test suites matching /progress-option/i.
Force exiting Jest: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished?

This log shows 2 situations that are added if or not.

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