我想结合故事书和开玩笑快照测试,但我没有让它发挥作用。 一旦我按照文档添加Snapshot.test.js,当我运行npm test时会导致跟随错误。
FAIL ./Storyshots.test.js Test suite failed to run
Cannot find module '../../package' from 'node.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:169:17)
at Object.<anonymous> (node_modules/babel-core/lib/api/node.js:60:16)
任何人都有线索/提示,如果这是实施失败或错误? thnx很多!
这是我的开玩笑配置,我给出了一个提示?
"jest": {
"rootDir": "",
"transform": {
".*": "<rootDir>/node_modules/babel-jest"
},
"moduleFileExtensions": [
"js",
"jsx"
],
"collectCoverage": false,
"collectCoverageFrom": [
"**/*.{js,jsx}",
"!**/node_modules/**",
"!**/vendor/**"
],
"coverageDirectory": "<rootDir>/coverage",
"setupTestFrameworkScriptFile": "<rootDir>/jestSetup.js",
"unmockedModulePathPatterns": [
"<rootDir>/node_modules/react",
"<rootDir>/node_modules/react-dom",
"<rootDir>/node_modules/react-addons-test-utils",
"moment",
"jasmine-expect-jsx",
"fbjs",
"enzyme",
"expect",
"cheerio",
"htmlparser2",
"lodash",
"domhandler",
"object.assign",
"define-properties",
"function-bind",
"object-keys",
"object.values",
"es-abstract"
]
},
答案 0 :(得分:3)
我有同样的问题,我的解决方案是添加&#34; json&#34;进入&#34; moduleFileExtensions&#34;,就像这样:
Sub FinalTest()
ActiveSheet.Shapes.AddChart2(332, xlLineMarkers).Select
ActiveChart.SetSourceData Source:=Range("A2:D352")
ActiveChart.FullSeriesCollection(1).Name = "=sheet1!$C$1"
ActiveChart.FullSeriesCollection(2).Name = "=sheet1!$D$1"
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = "TEST"
ActiveChart.SetElement (msoElementLegendRight)
With ActiveChart.Parent
.Height = 325 ' resize
.Width = 3000 ' resize
.Top = 100 ' reposition
.Left = 350 ' reposition
End With
End Sub
好像文件&#39;包&#39;不是js [x]文件,而是json文件,并且开玩笑拒绝加载它。