我一直在寻找答案。我怀疑这是一个.babelrc问题,但找不到有效的答案。
该应用程序运行正常,但据我发现,Jest和Rollup确实都依赖.babelrc。另一个可能的罪魁祸首是小叶。在我构建和测试的所有组件中,只有一个包含Leaflet的组件vue2-leaflet似乎有此问题。考虑到我正在开发地图绘制应用程序,这对我来说至关重要。
我在这里发帖,因为我什么都不能证明。还有许多其他人也遇到过类似的问题。
终端输出:
nr test:unit
> cxl-vue-leaflet@3.0.1-SNAPSHOT test:unit /Users/dan.mahoney/Projects/cxl-vue-leaflet
> NODE_ENV=testing BABEL_DISABLE_CACHE=1 jest --verbose --no-cache
Determining test suites to run...
# Starting...
# 1 test suites found.
# FAIL src/components/__test__/specs/cxl-vue-leaflet.spec.js
#
# /Users/dan.mahoney/Projects/cxl-vue-leaflet/node_modules/vuetify/lib/index.js:1
#
# ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Vuetify from './components/Vuetify';
# ^^^^^^^
#
# SyntaxError: Unexpected identifier
#
# Stack:
#
# at new Script (vm.js:85:7)
1..0
# Test Suites: 0% , 1 failed, 1 total
# Tests: 0 total
# Time: 2.088s
# …Run Code Online (Sandbox Code Playgroud)