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

chore(@vant/cli): 修复vue-jest生成sourcemap导致jest生成覆盖率失败 #7188

Merged
merged 3 commits into from Sep 16, 2020

Conversation

ChangeHow
Copy link
Contributor

BUG_REPORT:

使用@vant/cli迁移项目运行yarn test命令提示如下错误

 FAIL  src/price-label/test/index.spec.js
  ● Test suite failed to run

    /Users/chenzihao/Desktop/playground/vis-ui/vant-cli-migrate/src/price-label/components/price-label.vue: don't know how to turn this value into a node

      at valueToNode (../../vant/packages/vant-cli/node_modules/@babel/types/lib/converters/valueToNode.js:87:9)
      at Object.valueToNode (../../vant/packages/vant-cli/node_modules/@babel/types/lib/converters/valueToNode.js:81:58)
      at Object.exit (../../vant/packages/vant-cli/node_modules/istanbul-lib-instrument/dist/visitor.js:638:30)
      at PluginPass.exit (../../vant/packages/vant-cli/node_modules/babel-plugin-istanbul/lib/index.js:158:38)
      at newFn (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/traverse/lib/visitors.js:179:21)
      at NodePath._call (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/traverse/lib/path/context.js:55:20)
      at NodePath.call (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/traverse/lib/path/context.js:42:17)
      at NodePath.visit (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/traverse/lib/path/context.js:99:8)
      at TraversalContext.visitQueue (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/traverse/lib/context.js:112:16)
      at TraversalContext.visitSingle (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/traverse/lib/context.js:84:19)
      at TraversalContext.visit (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/traverse/lib/context.js:140:19)
      at Function.traverse.node (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/traverse/lib/index.js:84:17)
      at traverse (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/traverse/lib/index.js:66:12)
      at transformFile (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/core/lib/transformation/index.js:107:29)
          at transformFile.next (<anonymous>)
      at run (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/core/lib/transformation/index.js:35:12)
          at run.next (<anonymous>)
      at transform (../../vant/packages/vant-cli/node_modules/@jest/transform/node_modules/@babel/core/lib/transform.js:27:41)
          at transform.next (<anonymous>)
      at evaluateSync (../../vant/packages/vant-cli/node_modules/gensync/index.js:244:28)
      at sync (../../vant/packages/vant-cli/node_modules/gensync/index.js:84:14)
      at ScriptTransformer._instrumentFile (../../vant/packages/vant-cli/node_modules/@jest/transform/build/ScriptTransformer.js:388:46)

经过排查,发现是vue-jest为了测试方便在编码过程中为代码添加了source-map代码,但是在jest@25.x之后默认也会添加上source-map代码。

解决方案

升级vue-jest@4.0.0-rc.0,在这个版本中,去掉了vue-jest添加source-map的逻辑

相关issue

error: "don't know how to turn this value into a node" when using code coverage
[BREAKING CHANGE] remove inline source-map on process() output

@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2020

Codecov Report

Merging #7188 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev    #7188   +/-   ##
=======================================
  Coverage   91.04%   91.04%           
=======================================
  Files         177      177           
  Lines        4837     4837           
  Branches      291      291           
=======================================
  Hits         4404     4404           
  Misses        397      397           
  Partials       36       36           

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 49e9275...a2b9b9d. Read the comment docs.

@chenjiahan chenjiahan merged commit 472035c into youzan:dev Sep 16, 2020
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.

None yet

3 participants