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

test: make use of async/await #1996

Merged
merged 1 commit into from
Jun 10, 2019
Merged

test: make use of async/await #1996

merged 1 commit into from
Jun 10, 2019

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Jun 8, 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

We don't support Node6, so we can use async/await.

Breaking Changes

no

Additional Info

Next step, I'll refactor test/run-server and delete TODO.

@codecov
Copy link

codecov bot commented Jun 8, 2019

Codecov Report

Merging #1996 into next will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##            next   #1996   +/-   ##
=====================================
  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 4558b1e...0e0c340. Read the comment docs.

@hiroppy

This comment has been minimized.

"presets": ["@babel/preset-env"],
"env": {
"test": {
"plugins": ["@babel/plugin-transform-runtime"]
Copy link
Member Author

@hiroppy hiroppy Jun 8, 2019

Choose a reason for hiding this comment

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

jest uses babel as the default, so we need regeneratorruntime to use async/await. If we want to use the native async/await, we have to set current using @babel/env or reset transform.

Note: babel-jest is automatically installed when installing Jest and will automatically transform files if a babel configuration exists in your project. To avoid this behavior, you can explicitly reset the transform configuration option:

https://jestjs.io/docs/en/getting-started

Copy link
Member

Choose a reason for hiding this comment

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

We don't need this plugin for async/await:

  1. It is inside @babel/preset-env
  2. We use next branch, in node@8 it is built-in

Copy link
Member

@alexander-akait alexander-akait Jun 8, 2019

Choose a reason for hiding this comment

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

Jest doesn't use babel as the default, we need babel-jest package for this

Copy link
Member Author

@hiroppy hiroppy Jun 8, 2019

Choose a reason for hiding this comment

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

no, if we have .babelrc, jest uses babel-jest. See the documentation.
The section is Making your Babel config jest-aware.
In fact, we can use for-await-of with our current configuration. This is the feature that is only originally supported for v10 and higher.

We can set transform: {} for stopping to use babel, but we've already used ESM in client-src, so we should use babel in jest.

Copy link
Member

Choose a reason for hiding this comment

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

👍

@@ -1,5 +1,3 @@
'use strict';
Copy link
Member Author

Choose a reason for hiding this comment

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

Affected by "sourceType": "module" in ./client-src/.eslintrc

@hiroppy

This comment has been minimized.

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.

All good, one note

@hiroppy
Copy link
Member Author

hiroppy commented Jun 10, 2019

I want to wait for #2005 merged

@hiroppy hiroppy merged commit fc87a6b into next 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 15, 2019
hiroppy added a commit that referenced this pull request Jun 15, 2019
hiroppy added a commit that referenced this pull request Jun 15, 2019
hiroppy added a commit that referenced this pull request Jun 15, 2019
hiroppy added a commit that referenced this pull request Jun 24, 2019
hiroppy added a commit that referenced this pull request Jun 24, 2019
knagaitsev pushed a commit to knagaitsev/webpack-dev-server that referenced this pull request Jul 31, 2019
hiroppy added a commit that referenced this pull request Aug 1, 2019
hiroppy added a commit that referenced this pull request Aug 2, 2019
hiroppy added a commit that referenced this pull request Aug 5, 2019
hiroppy added a commit that referenced this pull request Sep 10, 2019
hiroppy added a commit that referenced this pull request Dec 12, 2019
hiroppy added a commit that referenced this pull request Dec 18, 2019
hiroppy added a commit that referenced this pull request Dec 19, 2019
hiroppy added a commit that referenced this pull request Dec 23, 2019
hiroppy added a commit that referenced this pull request Dec 24, 2019
alexander-akait pushed a commit that referenced this pull request Jan 29, 2020
alexander-akait pushed a commit that referenced this pull request Jan 31, 2020
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.

None yet

2 participants