Skip to content

Jest tests failing due to possible Babel mis-config #5441

Closed
@jfbrennan

Description

@jfbrennan

Version

4.3.1

Environment info

Environment Info:

  System:
    OS: macOS 10.15.2
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 13.12.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 6.14.4 - /usr/local/bin/npm
  Browsers:
    Chrome: 81.0.4044.129
    Firefox: 74.0.1
    Safari: 13.0.4
  npmPackages:
    @vue/cli-overlay:  4.3.1 
    @vue/cli-plugin-router: ^4.3.1 => 4.3.1 
    @vue/cli-plugin-unit-jest: ^4.3.1 => 4.3.1 
    @vue/cli-plugin-vuex:  4.3.1 
    @vue/cli-service: ^4.3.1 => 4.3.1 
    @vue/cli-shared-utils:  4.3.1 
    @vue/component-compiler-utils:  3.1.2 
    @vue/preload-webpack-plugin:  1.1.1 
    @vue/test-utils: 1.0.0-beta.33 => 1.0.0-beta.33 
    @vue/web-component-wrapper:  1.2.0 
    jest-serializer-vue:  2.0.2 
    vue: ^2.6.11 => 2.6.11 
    vue-hot-reload-api:  2.3.4 
    vue-jest:  3.0.5 
    vue-loader:  15.9.1 
    vue-router: ^3.1.6 => 3.1.6 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.6.11 => 2.6.11 
    vue-template-es2015-compiler:  1.9.1 
  npmGlobalPackages:
    @vue/cli: 4.3.1

Steps to reproduce

Sorry, code can't be made public.

I created a project with Vue CLI and selected Jest for tests and NO Babel.

What is expected?

Tests execute with pass or fail.

What is actually happening?

Tests are not executing, but the run fails with these errors that make me think there is something mis-configured with the Vue CLI stuff, perhaps inside test-utils (obfuscated the path):

Failed to collect coverage from /xxxxx/frontend/client/src/components/benchmarks-breakdown.vue
ERROR: .plugins[0] must be a string, object, function
STACK: Error: .plugins[0] must be a string, object, function
at assertPluginTarget (/xxxxx/frontend/client/node_modules/@babel/core/lib/config/validation/option-assertions.js:264:11)
at assertPluginItem (/xxxxx/frontend/client/node_modules/@babel/core/lib/config/validation/option-assertions.js:256:5)
at /xxxxx/frontend/client/node_modules/@babel/core/lib/config/validation/option-assertions.js:222:30
at Array.forEach ()
at assertPluginList (/xxxxx/frontend/client/node_modules/@babel/core/lib/config/validation/option-assertions.js:222:9)
at /xxxxx/frontend/client/node_modules/@babel/core/lib/config/validation/options.js:108:5
at Array.forEach ()
at validateNested (/xxxxx/frontend/client/node_modules/@babel/core/lib/config/validation/options.js:84:21)
at validate (/xxxxx/frontend/client/node_modules/@babel/core/lib/config/validation/options.js:75:10)
at loadPrivatePartialConfig (/xxxxx/frontend/client/node_modules/@babel/core/lib/config/partial.js:76:50)


My package.json:

{
"name": "xxxxxxx",
"version": "0.1.0",
"private": true,
"scripts": {
"build": "vue-cli-service build --dest ../server/public --no-clean",
"build:dev": "vue-cli-service build --mode development --dest ../server/public --no-clean --watch",
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"flat": "^5.0.0",
"vega": "^5.10.1",
"vega-lite": "^4.11.0",
"vue": "^2.6.11",
"vue-router": "^3.1.6"
},
"devDependencies": {
"@vue/cli-plugin-router": "^4.3.1",
"@vue/cli-plugin-unit-jest": "^4.3.1",
"@vue/cli-service": "^4.3.1",
"@vue/test-utils": "1.0.0-beta.33",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"> 10%",
"last 2 versions",
"not dead"
],
"jest": {
"preset": "@vue/cli-plugin-unit-jest/presets/no-babel",
"collectCoverage": true,
"collectCoverageFrom": [
"src/**/*.{js,vue}"
],
"coverageReporters": [
"html",
"text-summary"
]
}
}

My vue.config.js:

module.exports = {
// Disable hashes in filenames (we'll create our own when uploading to CDN)
filenameHashing: false,

// Delete HTML related webpack plugins
chainWebpack: config => {
config.plugins.delete('html');
config.plugins.delete('preload');
config.plugins.delete('prefetch');
}
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions