Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Cannot read property 'fileCoverage' of undefined - Babel 7 #90

Open
mkapiczy opened this issue Nov 12, 2018 · 12 comments
Open

Cannot read property 'fileCoverage' of undefined - Babel 7 #90

mkapiczy opened this issue Nov 12, 2018 · 12 comments

Comments

@mkapiczy
Copy link

After upgrading to babel 7 I started receiving the error, and none of the related issues I have found helped to solve it. Removing the istambul-instrumenter-loader rule from the webpack configuration the error disappears, bot the coverage does not work.

ERROR in ./src/components/Applications/ApplicationList.vue?vue&type=style&index=0&id=53568832&lang=scss&scoped=true& (./node_modules/istanbul-instrumenter-loader/dist/cjs.js??ref--0!./node_modules/vue-style-loader!./node_modules/css-loader!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Applications/ApplicationList.vue?vue&type=style&index=0&id=53568832&lang=scss&scoped=true&)
Module build failed (from ./node_modules/istanbul-instrumenter-loader/dist/cjs.js):
TypeError: Cannot read property 'fileCoverage' of undefined
    at Instrumenter.instrumentSync (/Users/user/Projects/Sirenia/cuesta/node_modules/istanbul-lib-instrument/dist/instrumenter.js:148:40)
    at Instrumenter.instrument (/Users/user/Projects/Sirenia/cuesta/node_modules/istanbul-lib-instrument/dist/instrumenter.js:177:32)
    at Object.exports.default (/Users/user/Projects/Sirenia/cuesta/node_modules/istanbul-instrumenter-loader/dist/index.js:25:16)
 @ ./src/components/Applications/ApplicationList.vue?vue&type=style&index=0&id=53568832&lang=scss&scoped=true& 1:677-1115 1:1130-1133 1:1134-1568 1:1134-1568
 @ ./src/components/Applications/ApplicationList.vue
 @ ./src sync ^\.\/(?!main(\.js)?$)
 @ ./test/unit/index.js

babel-plugin-istanbul: 5.1.0
node: 9.11.2
npm: 5.6.0

package.json

 "dependencies": {
    "@babel/runtime": "^7.1.2",
    "axios": "^0.15.3",
    "espree": "^3.5.3",
    "estree-walker": "^0.3.1",
    "fuzzy": "^0.1.3",
    "jshint": "^2.9.5",
    "jwt-decode": "^2.1.0",
    "later": "sireniaeu/later",
    "lockr": "^0.8.4",
    "lodash": "^4.17.5",
    "moment": "^2.22.2",
    "monaco-editor": "^0.14.3",
    "monaco-editor-webpack-plugin": "^1.5.1",
    "node-blockly": "^1.0.35",
    "papaparse": "^4.4.0",
    "prettycron": "sireniaeu/prettycron",
    "query-string": "^4.2.3",
    "rxjs": "^6.1.0",
    "rxjs-compat": "^6.1.0",
    "tinycolor2": "^1.4.1",
    "uuid": "^3.2.1",
    "v-calendar": "^0.9.7",
    "vue": "^2.5.16",
    "vue-i18n": "^5.0.3",
    "vue-js-modal": "^1.3.16",
    "vue-router": "^2.8.0",
    "vue-rx": "^5.0.0",
    "vue-shortkey": "^3.1.0",
    "vue-template-compiler": "^2.5.16",
    "vuelidate": "^0.7.4",
    "webfontloader": "^1.6.27"
  },
  "devDependencies": {
    "@babel/core": "^7.1.2",
    "@babel/plugin-proposal-class-properties": "^7.1.0",
    "@babel/plugin-proposal-export-default-from": "^7.0.0",
    "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
    "@babel/plugin-proposal-json-strings": "^7.0.0",
    "@babel/plugin-proposal-object-rest-spread": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/plugin-syntax-flow": "^7.0.0",
    "@babel/plugin-syntax-import-meta": "^7.0.0",
    "@babel/plugin-syntax-jsx": "^7.0.0",
    "@babel/plugin-transform-arrow-functions": "^7.0.0",
    "@babel/plugin-transform-flow-strip-types": "^7.0.0",
    "@babel/plugin-transform-runtime": "^7.1.0",
    "@babel/polyfill": "^7.0.0",
    "@babel/preset-env": "^7.1.0",
    "@babel/preset-flow": "^7.0.0",
    "@babel/register": "^7.0.0",
    "autoprefixer": "^7.2.6",
    "babel-eslint": "^8.2.3",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-loader": "^8.0.4",
    "babel-plugin-istanbul": "^5.1.0",
    "babel-plugin-tcomb": "^0.3.27",
    "babel-plugin-transform-vue-jsx": "^4.0.1",
    "chai": "^4.1.2",
    "chromedriver": "^2.42.0",
    "connect-history-api-fallback": "^1.5.0",
    "cross-spawn": "^6.0.4",
    "css-loader": "^0.28.9",
    "documentation": "^6.2.0",
    "electron-debug": "^1.5.0",
    "eslint": "^4.19.1",
    "eslint-config-standard": "^7.0.0",
    "eslint-friendly-formatter": "^2.0.7",
    "eslint-loader": "2.1.0",
    "eslint-plugin-flowtype": "^2.46.3",
    "eslint-plugin-flowtype-errors": "^3.5.1",
    "eslint-plugin-html": "^4.0.3",
    "eslint-plugin-promise": "^3.5.0",
    "eslint-plugin-standard": "^3.0.1",
    "eslint-plugin-vue": "^4.7.1",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.16.2",
    "file-loader": "^1.1.6",
    "flow": "^0.2.3",
    "flow-bin": "^0.70.0",
    "function-bind": "^1.1.1",
    "html-webpack-plugin": "^3.2.0",
    "http-proxy-middleware": "^0.19.0",
    "inject-loader": "^4.0.1",
    "istanbul-instrumenter-loader": "^3.0.1",
    "karma": "^3.1.1",
    "karma-chrome-launcher": "^2.2.0",
    "karma-coverage": "^1.1.2",
    "karma-coverage-istanbul-reporter": "^2.0.4",
    "karma-mocha": "^1.3.0",
    "karma-sinon-chai": "^2.0.2",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-spec-reporter": "^0.0.32",
    "karma-webpack": "^4.0.0-rc.2",
    "lolex": "^2.3.2",
    "mini-css-extract-plugin": "^0.4.0",
    "mocha": "^5.0.1",
    "nightwatch": "^0.9.21",
    "node-sass": "^4.7.2",
    "opn": "^5.2.0",
    "ora": "^1.4.0",
    "polyfill": "^0.1.0",
    "puppeteer": "^1.8.0",
    "sass-loader": "^6.0.6",
    "scss-loader": "0.0.1",
    "selenium-server": "^3.14.0",
    "shelljs": "^0.8.1",
    "sinon": "^4.3.0",
    "sinon-chai": "^2.14.0",
    "tcomb": "^3.2.28",
    "url-loader": "^0.6.2",
    "vue-loader": "^15.4.2",
    "vue-style-loader": "^4.1.2",
    "webpack": "^4.17.1",
    "webpack-bundle-analyzer": "^3.0.3",
    "webpack-dev-server": "^3.1.10",
    "webpack-hot-middleware": "^2.24.3",
    "webpack-merge": "^4.1.4"
  }

webpack.base.conf.js

var path = require('path')
var config = require('../config')
var utils = require('./utils')
var webpack = require('webpack')
var projectRoot = path.resolve(__dirname, '../')
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
  entry: {
    app: './src/main.js'
  },
  output: {
    path: config.build.assetsRoot,
    publicPath: process.env.NODE_ENV === 'production' ? "." + config.build.assetsPublicPath : config.dev.assetsPublicPath,
    filename: '[name].js'
  },
  resolve: {
    extensions: ['.js', '.vue'],
    alias: {
      'src': path.resolve(__dirname, '../src'),
      'assets': path.resolve(__dirname, '../src/assets'),
      'components': path.resolve(__dirname, '../src/components'),
      'scss': path.resolve(__dirname, '../src/scss'),
      'services': path.resolve(__dirname, '../src/services'),
      'ui': path.resolve(__dirname, '../src/components/UI'),
      'utility': path.resolve(__dirname, '../src/util.js')
    },
    modules: [
      'node_modules'
    ]
  },
  resolveLoader: {
    modules: [
      'node_modules'
    ],
  },
  module: {
    rules: [
      {
        test: /\.vue$/,
        enforce: 'pre',
        loader: 'eslint-loader',
        include: projectRoot,
        exclude: /node_modules/,
        options: {
          fix: true
        }
      },
      {
        test: /\.js$/,
        enforce: 'pre',
        loader: 'eslint-loader',
        include: projectRoot,
        exclude: /node_modules/,
        options: {
          fix: true
        }
      },
      {
        test: /\.vue$/,
        loader: 'vue-loader'
      },
      {
        test: /\.(js|js.flow)$/,
        exclude: /node_modules/,
        include: projectRoot,
        use: {
          loader: 'babel-loader'
        }
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('img/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
        }
      }
    ]
  },
  plugins: [
    new webpack.LoaderOptionsPlugin({
      options: {
        eslint: {
          formatter: require('eslint-friendly-formatter')
        },
        vue: {
          loaders: utils.cssLoaders(),
          postcss: [
            require('autoprefixer')({
              browsers: ['last 2 versions']
            })
          ]
        }
      }
    }),
    new MonacoWebpackPlugin({
      languages: ['javascript', 'typescript']
    }),
    new VueLoaderPlugin()
  ],
  performance: {
    hints: false
  }
}

webpack.test.conf.js

'use strict'
// This is the webpack config used for unit tests.

var path = require('path')
var merge = require('webpack-merge')
var baseConfig = require('./webpack.base.conf')
var utils = require('./utils')
var webpack = require('webpack')
var projectRoot = path.resolve(__dirname, '../../')

var webpackConfig = merge(baseConfig, {
  mode: 'development',
  resolve: {
    alias: {
      // a hackish way to ignore coverage on node_modules `.vue` files. In a nutshell, we alias those modules to an object and then they won't be part of the coverage report
      'vue-codemirror': path.resolve(projectRoot, 'test/unit/alias')
    }
  },
  // use inline sourcemap for karma-sourcemap-loader
  module: {
    rules: utils.styleLoaders(),
  },
  devtool: '#inline-source-map',
  plugins: [
    new webpack.DefinePlugin({
      'process.env': require('../config/test.env')
    })
  ]
})

webpackConfig.module.rules.unshift({
  test: /\.js$|\.vue$/,
  use: {
    loader: 'istanbul-instrumenter-loader',
    options: { esModules: true }
  },
  enforce: 'post',
  exclude: /node_modules|\.spec\.js$/
})

// no need for app entry during tests
delete webpackConfig.entry

module.exports = webpackConfig

karma.conf.js

// This is a karma config file. For more details see
//   http://karma-runner.github.io/0.13/config/configuration-file.html
// we are also using it with karma-webpack
//   https://github.com/webpack/karma-webpack
const path = require('path')
var webpackConfig = require('../../build/webpack.test.conf')

module.exports = function (config) {
  config.set({
    // to run in additional browsers:
    // 1. install corresponding karma launcher
    //    http://karma-runner.github.io/0.13/config/browsers.html
    // 2. add it to the `browsers` array below.
    plugins: [
      'karma-chrome-launcher',
      'karma-mocha',
      'karma-sinon-chai',
      'karma-sourcemap-loader',
      'karma-spec-reporter',
      'karma-webpack',
      'karma-coverage-istanbul-reporter'
    ],
    browsers: ['Chrome_no_sandbox'],
    customLaunchers: {
      Chrome_no_sandbox: {
        base: 'Chrome',
        flags: [
          '--no-sandbox',
          '--disable-setuid-sandbox',
          '--headless',
          '--disable-gpu',
          '--remote-debugging-port=9222',
        ],
      },
    },
    frameworks: ['mocha', 'sinon-chai'],
    files: ['./index.js'],
    preprocessors: {
      './index.js': ['webpack', 'sourcemap']
    },
    webpack: webpackConfig,
    webpackMiddleware: {
      noInfo: true
    },
    reporters: ['spec', 'coverage-istanbul'],
    // any of these options are valid: https://github.com/istanbuljs/istanbuljs/blob/aae256fb8b9a3d19414dcf069c592e88712c32c6/packages/istanbul-api/lib/config.js#L33-L39
    coverageIstanbulReporter: {
      dir: path.join(__dirname, 'coverage'),
      reports: ['lcov', 'text-summary'],
      includeAllSources: true,
      // if using webpack and pre-loaders, work around webpack breaking the source path
      fixWebpackSourcePaths: true,
      skipFilesWithNoCoverage: false
    },
    // Otherwise gitlab pipeline results with timeout
    browserNoActivityTimeout: 60000
  })
}

.babelrc

{
  "presets": [
   ["@babel/preset-env", { "modules": false }],
    "@babel/preset-flow"
  ],
  "plugins": [
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-export-default-from",
    "@babel/plugin-proposal-export-namespace-from",
    "@babel/plugin-proposal-json-strings",
    "@babel/plugin-proposal-object-rest-spread",
    "@babel/plugin-syntax-dynamic-import",
    "@babel/plugin-syntax-flow",
    "@babel/plugin-syntax-import-meta",
    "@babel/plugin-syntax-jsx",
    "@babel/plugin-transform-arrow-functions",
    "@babel/plugin-transform-flow-strip-types",
    "@babel/plugin-transform-runtime",
    "transform-export-extensions",
    "transform-vue-jsx"
  ],
  "comments": false,
  "env": {
   "development": {
//        "plugins": ["tcomb"]
    },
    "test": {
      "presets": ["@babel/preset-env"],
      "plugins": ["transform-vue-jsx", "istanbul"]
    }
  }
}

@jdoubleu
Copy link

I'm also getting these error messages.
Please note vuejs/vue-cli#1363 (comment).

@martinnaughton
Copy link

martinnaughton commented Dec 5, 2018

@mkapiczy was babel 7 the only thing you upgraded?

@woram-nyansa
Copy link

Encountered this error today and couldn't configure my way out of it for the life of me. I later discovered Webpack had been misconfigured to run the instrumenter task twice. Configuring it to run once eliminated the error.

So, check your webpack test runner configuration. Even if you configured the instrumenter yourself, you may have obscure code that does the same thing automatically!

@ShinyChang
Copy link

ShinyChang commented Jan 4, 2019

Hi @mkapiczy , can you try to remove the "istanbul" from .babelrc and add istambul-instrumenter-loader back to your loader.

Both babel-plugin and webpack-loader will run the instrumenter task. As you can see, the output will be

ee.exit(path); // undefined

once program exit (actually, I don't know what program is it)

For me, I choose remove the babel-plugin-istanbul and setting istambul-instrumenter-loader in the wbpack configuration.

Update
You should use babel-plugin-istanbul if you faced TypeError: Cannot read property 'text' of undefined and setting include / exclude in the .babelrc, for more infor please refer gotwarlost/istanbul#602 (comment)

@iamahuman
Copy link

iamahuman commented May 25, 2019

This seems almost always caused by an already instrumented code -- the only way the undefined value would appear from is:

https://github.com/istanbuljs/istanbuljs/blob/bf3a53942d45eb4382f524fda6f4ded426b55fc9/packages/istanbul-lib-instrument/src/visitor.js#L618-L621

@silva96
Copy link

silva96 commented Jun 24, 2019

@iamahuman @woram-nyansa you say the cause but not the solution, can you please help me finding the solution?

Here is my configs:

vue.config.js

module.exports = {
  devServer: {
    port: process.env.VUE_APP_PORT,
    allowedHosts: [process.env.VUE_APP_HOST]
  },
  chainWebpack: config => {
    const svgRule = config.module.rule('svg')
    svgRule.uses.clear()
    svgRule.use('vue-svg-loader').loader('vue-svg-loader')
    config.output.globalObject('this')

    if (process.env.NODE_ENV === 'test') {
      // To debug using vscode
      config.devtool = '#inline-cheap-module-source-map'

      const path = require('path')
      config.module
        .rule('istanbul')
        .test(/\.(ts|vue)$/)
        .enforce('post')
        .include.add(path.resolve(__dirname, 'src'))
        .end()
        .use('istanbul-instrumenter-loader')
        .loader('istanbul-instrumenter-loader')
        .options({ esModules: true })
    }
  }
}

babel.config.js

module.exports = {
  presets: [
    [
      '@vue/app',
      {
        useBuiltIns: 'entry'
      }
    ]
  ],
  plugins: [
    [
      'transform-imports',
      {
        vuetify: {
          transform: 'vuetify/es5/components/${member}', // eslint-disable-line no-template-curly-in-string
          preventFullImport: true
        }
      }
    ]
  ],
  env: {
    test: {
      presets: ['@babel/preset-env'],
      plugins: ['istanbul']
    }
  }
}

package.json

...
"dependencies": {
    "@babel/polyfill": "^7.0.0-rc.1",
    "@casl/ability": "^3.0.1",
    "@casl/vue": "^0.5.1",
    "@fullcalendar/core": "^4.2.0",
    "@fullcalendar/daygrid": "^4.1.0",
    "@fullcalendar/list": "^4.1.0",
    "@fullcalendar/timegrid": "^4.1.0",
    "@fullcalendar/vue": "^4.1.0",
    "@tinymce/tinymce-vue": "^1.1.0",
    "@types/lodash": "^4.14.120",
    "@types/moment-timezone": "^0.5.10",
    "@types/rosie": "0.0.36",
    "@types/sinon": "^7.0.5",
    "actioncable-vue": "^1.2.4",
    "aws-sdk": "^2.336.0",
    "dotenv": "^6.1.0",
    "element-ui": "2.9.2",
    "filesize": "^4.0.0",
    "flush-promises": "^1.0.2",
    "jwt-decode": "^2.2.0",
    "material-design-icons-iconfont": "^3.0.3",
    "moment": "^2.22.2",
    "moment-timezone": "^0.5.23",
    "roboto-fontface": "*",
    "rosie": "^2.0.1",
    "rut-helpers": "^0.1.1",
    "s3-easy-deploy": "^1.1.0",
    "tinycolor2": "^1.4.1",
    "v-calendar": "^1.0.0-beta.14",
    "v-click-outside": "^2.1.1",
    "v-money": "^0.8.1",
    "vue": "^2.5.21",
    "vue-class-component": "^6.3.2",
    "vue-clickaway": "^2.2.2",
    "vue-full-loading": "^1.2.1",
    "vue-i18n": "^8.7.0",
    "vue-lodash": "^2.0.0",
    "vue-mixin-decorator": "^1.1.0",
    "vue-moment": "^4.0.0",
    "vue-pdf": "arioth/vue-pdf#253f6186ff0676abf9277786087dda8d95dd8ea7",
    "vue-property-decorator": "^7.3.0",
    "vue-resource": "^1.5.1",
    "vue-router": "^3.0.1",
    "vue-svgicon": "^3.2.2",
    "vue-tel-input": "^2.0.13",
    "vue-wait": "arioth/vue-wait#b6cabe208f3d552fb62bc69621d60dda755bb643",
    "vuedraggable": "^2.20.0",
    "vuex": "^3.0.1",
    "vuex-class": "^0.3.1",
    "vuex-persistedstate": "^2.5.4"
  },
  "devDependencies": {
    "@babel/core": "^7.3.3",
    "@babel/preset-env": "^7.0.0",
    "@types/chai": "^4.1.7",
    "@types/mocha": "^5.2.4",
    "@vue/cli-plugin-babel": "^3.4.1",
    "@vue/cli-plugin-e2e-nightwatch": "^3.8.0",
    "@vue/cli-plugin-eslint": "^3.0.1",
    "@vue/cli-plugin-typescript": "^3.6.0",
    "@vue/cli-plugin-unit-mocha": "^3.0.1",
    "@vue/cli-service": "^3.6.0",
    "@vue/eslint-config-typescript": "^3.0.1",
    "babel-loader": "^8.0.2",
    "babel-plugin-istanbul": "^5.1.4",
    "babel-plugin-transform-imports": "^1.5.0",
    "chai": "^4.2.0",
    "electron": "^4.0.2",
    "eslint": "^5.10.0",
    "eslint-plugin-vue": "^5.0.0",
    "istanbul-instrumenter-loader": "^3.0.1",
    "jsdom": "^13.2.0",
    "jsdom-global": "^3.0.2",
    "node-sass": "^4.11.0",
    "nyc": "^14.1.1",
    "pug": "^2.0.3",
    "pug-plain-loader": "^1.0.0",
    "sass-loader": "^7.0.1",
    "sinon": "^7.2.3",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.1",
    "typescript": "~3.1.1",
    "vue-svg-loader": "^0.11.0",
    "vue-template-compiler": "^2.5.21",
    "webpack": "^4.17.2"
  },
  "nyc": {
    "check-coverage": true,
    "per-file": true,
    "lines": 90,
    "statements": 90,
    "functions": 90,
    "branches": 90,
    "include": [
      "src/**/*.{ts,vue}"
    ],
    "reporter": [
      "lcov",
      "text-summary"
    ],
    "extension": [
      ".ts",
      ".vue"
    ],
    "cache": true,
    "all": true
  }

@iamahuman
Copy link

iamahuman commented Jun 24, 2019

@silva96 This is not necessarily istanbul-instrumenter-loader's fault, and in my case it was due to an issue in vue-loader pitcher's loader request injection which managed to come to the surface via an edge case introduced by throwing both TypeScript loader and Vue SFC loader into the mix, but it wasn't pretty easy to come up with a clean solution and then soon after a while I forgot about it.

@iamahuman
Copy link

iamahuman commented Jun 24, 2019

@silva96 In your case, you might have some luck by taking out either one of the following lines in your vue.config.js:

        .use('istanbul-instrumenter-loader')
        .loader('istanbul-instrumenter-loader')

@iamahuman
Copy link

Back to on-topic discussion, a solution for this issue would be to notify user of the duplicated instrumentation instead of the unhelpful message, since ignoring it would highly likely introduce yet another obscure bug which might be even harder to trace.

@iamahuman
Copy link

Since it is clear that this issue is solely caused by instrumenting already instrumented code I'd like to suggest type: Bug, priority: 5 (nice to have), severity: 5 (confusing).

@silva96
Copy link

silva96 commented Jun 24, 2019

@iamahuman

@silva96 In your case, you might have some luck by taking out either one of the following lines in your vue.config.js:

        .use('istanbul-instrumenter-loader')
        .loader('istanbul-instrumenter-loader')

That didn't work
Taking .loader('istanbul-instrumenter-loader') out:

nyc vue-cli-service test:unit --require ./tests/unit/setup.js --timeout 10000

Error: No loader specified
    at Function.normalizeUseItem (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/RuleSet.js:389:10)
    at Function.normalizeUse (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/RuleSet.js:360:19)
    at use.map (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/RuleSet.js:357:33)
    at Array.map (<anonymous>)
    at Function.normalizeUse (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/RuleSet.js:357:6)
    at Function.normalizeRule (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/RuleSet.js:288:26)
    at rules.map (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/RuleSet.js:110:20)
    at Array.map (<anonymous>)
    at Function.normalizeRules (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/RuleSet.js:109:17)
    at new RuleSet (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/RuleSet.js:104:24)
    at VueLoaderPlugin.apply (/Users/benja/dev/ventanilla-front/node_modules/vue-loader/lib/plugin.js:35:23)
    at webpack (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/webpack.js:37:12)
    at createCompiler (/Users/benja/dev/ventanilla-front/node_modules/mocha-webpack/lib/webpack/compiler/createCompiler.js:15:40)
    at TestRunner.<anonymous> (/Users/benja/dev/ventanilla-front/node_modules/mocha-webpack/lib/runner/TestRunner.js:166:51)
    at eval (eval at processIncludes (/Users/benja/dev/ventanilla-front/node_modules/nodent-runtime/runtime.js:36:12), <anonymous>:3:4725)
 ERROR  mocha-webpack exited with code 1.

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ventas-frontend@0.1.0 test:unit: `nyc vue-cli-service test:unit --require ./tests/unit/setup.js --timeout 10000`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ventas-frontend@0.1.0 test:unit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/benja/.npm/_logs/2019-06-24T16_20_43_535Z-debug.log

Taking .use('istanbul-instrumenter-loader') out

nyc vue-cli-service test:unit --require ./tests/unit/setup.js --timeout 10000

/Users/benja/dev/ventanilla-front/vue.config.js:23
        .loader('istanbul-instrumenter-loader')
         ^

TypeError: config.module.rule(...).test(...).enforce(...).include.add(...).end(...).loader is not a function
    at chainWebpack (/Users/benja/dev/ventanilla-front/vue.config.js:23:10)
    at webpackChainFns.forEach.fn (/Users/benja/dev/ventanilla-front/node_modules/@vue/cli-service/lib/Service.js:227:40)
    at Array.forEach (<anonymous>)
    at Service.resolveChainableWebpackConfig (/Users/benja/dev/ventanilla-front/node_modules/@vue/cli-service/lib/Service.js:227:26)
    at Service.resolveWebpackConfig (/Users/benja/dev/ventanilla-front/node_modules/@vue/cli-service/lib/Service.js:231:48)
    at Object.<anonymous> (/Users/benja/dev/ventanilla-front/node_modules/@vue/cli-service/webpack.config.js:12:26)
    at Module._compile (internal/modules/cjs/loader.js:723:30)
    at Module.replacementCompile (/Users/benja/dev/ventanilla-front/node_modules/append-transform/index.js:58:13)
    at Module._extensions..js (internal/modules/cjs/loader.js:734:10)
    at Object.<anonymous> (/Users/benja/dev/ventanilla-front/node_modules/append-transform/index.js:62:4)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:659:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at requireWebpackConfig (/Users/benja/dev/ventanilla-front/node_modules/mocha-webpack/lib/cli/requireWebpackConfig.js:99:14)
 ERROR  mocha-webpack exited with code 1.

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ventas-frontend@0.1.0 test:unit: `nyc vue-cli-service test:unit --require ./tests/unit/setup.js --timeout 10000`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ventas-frontend@0.1.0 test:unit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/benja/.npm/_logs/2019-06-24T16_22_05_206Z-debug.log

Taking both out:

 MOCHA  Testing...

 RUNTIME EXCEPTION  Exception occurred while loading your tests

TypeError: Cannot read property 'f' of undefined
    at Module.getTimezones (/Users/benja/dev/ventanilla-front/dist/webpack:/src/utils/functions.ts:62:1)
    at Module../src/store/modules/settings/getters.ts (/Users/benja/dev/ventanilla-front/dist/webpack:/src/store/modules/settings/getters.ts:35:1)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at Module../src/store/modules/settings/index.ts (/Users/benja/dev/ventanilla-front/dist/main.js:388129:66)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at Module../src/store/index.ts (/Users/benja/dev/ventanilla-front/dist/main.js:351856:75)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at Module../src/utils/functions.ts (/Users/benja/dev/ventanilla-front/dist/main.js:397749:64)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/inputs/types/SeatSelectInput.vue?vue&type=script&lang=ts& (/Users/benja/dev/ventanilla-front/dist/main.js:40141:74)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at Module../src/components/inputs/types/SeatSelectInput.vue?vue&type=script&lang=ts& (/Users/benja/dev/ventanilla-front/dist/webpack:/src/components/inputs/types/SeatSelectInput.vue?c6eb:1:1)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at Module../src/components/inputs/types/SeatSelectInput.vue (/Users/benja/dev/ventanilla-front/dist/webpack:/src/components/inputs/types/SeatSelectInput.vue?c837:1:1)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/inputs/types/SeatMapBuilder.vue?vue&type=script&lang=ts& (/Users/benja/dev/ventanilla-front/dist/main.js:38302:102)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at Module../src/components/inputs/types/SeatMapBuilder.vue?vue&type=script&lang=ts& (/Users/benja/dev/ventanilla-front/dist/webpack:/src/components/inputs/types/SeatMapBuilder.vue?905a:1:1)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at Module../src/components/inputs/types/SeatMapBuilder.vue (/Users/benja/dev/ventanilla-front/dist/webpack:/src/components/inputs/types/SeatMapBuilder.vue?56f0:1:1)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at Module../tests/unit/components/inputs/types/SeatMapBuilder.spec.ts (/Users/benja/dev/ventanilla-front/dist/main.js:403757:101)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at run (/Users/benja/dev/ventanilla-front/dist/webpack:/node_modules/mocha-webpack/lib/entry.js:3:1)
    at Array.forEach (<anonymous>)
    at Object../node_modules/mocha-webpack/lib/entry.js (/Users/benja/dev/ventanilla-front/dist/webpack:/node_modules/mocha-webpack/lib/entry.js:10:1)
    at __webpack_require__ (/Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:25:1)
    at /Users/benja/dev/ventanilla-front/dist/webpack:/webpack/bootstrap:116:1
    at Object.<anonymous> (/Users/benja/dev/ventanilla-front/dist/main.js:120:10)
    at Module._compile (internal/modules/cjs/loader.js:723:30)
    at Module.replacementCompile (/Users/benja/dev/ventanilla-front/node_modules/append-transform/index.js:58:13)
    at _module2.default._extensions.(anonymous function) (/Users/benja/dev/ventanilla-front/node_modules/mocha-webpack/lib/util/registerRequireHook.js:148:12)
    at Object.<anonymous> (/Users/benja/dev/ventanilla-front/node_modules/append-transform/index.js:62:4)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:659:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at /Users/benja/dev/ventanilla-front/node_modules/mocha/lib/mocha.js:250:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/Users/benja/dev/ventanilla-front/node_modules/mocha/lib/mocha.js:247:14)
    at Mocha.run (/Users/benja/dev/ventanilla-front/node_modules/mocha/lib/mocha.js:576:10)
    at /Users/benja/dev/ventanilla-front/node_modules/mocha-webpack/lib/runner/TestRunner.js:191:27
    at /Users/benja/dev/ventanilla-front/node_modules/mocha-webpack/lib/webpack/compiler/registerReadyCallback.js:26:7
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/benja/dev/ventanilla-front/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:63:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/benja/dev/ventanilla-front/node_modules/tapable/lib/Hook.js:35:21)
    at emitRecords.err (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/Compiler.js:257:22)
    at Compiler.emitRecords (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/Compiler.js:372:39)
    at emitAssets.err (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/Compiler.js:251:10)
    at hooks.afterEmit.callAsync.err (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/Compiler.js:358:14)
    at _err0 (eval at create (/Users/benja/dev/ventanilla-front/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:16:1)
    at callback (/Users/benja/dev/ventanilla-front/node_modules/copy-webpack-plugin/dist/index.js:126:17)
    at afterEmit (/Users/benja/dev/ventanilla-front/node_modules/copy-webpack-plugin/dist/index.js:220:13)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/benja/dev/ventanilla-front/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:12:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/benja/dev/ventanilla-front/node_modules/tapable/lib/Hook.js:35:21)
    at asyncLib.forEach.err (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/Compiler.js:355:27)
    at done (/Users/benja/dev/ventanilla-front/node_modules/neo-async/async.js:2854:11)
    at /Users/benja/dev/ventanilla-front/node_modules/neo-async/async.js:2805:7
    at MemoryFileSystem.writeFile (/Users/benja/dev/ventanilla-front/node_modules/memory-fs/lib/MemoryFileSystem.js:328:9)
    at writeOut (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/Compiler.js:339:29)
    at asyncLib.forEach (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/Compiler.js:349:7)
    at baseEach (/Users/benja/dev/ventanilla-front/node_modules/neo-async/async.js:2416:9)
    at Object.each (/Users/benja/dev/ventanilla-front/node_modules/neo-async/async.js:2843:9)
    at emitFiles (/Users/benja/dev/ventanilla-front/node_modules/webpack/lib/Compiler.js:312:13)
    at Immediate._onImmediate (/Users/benja/dev/ventanilla-front/node_modules/memory-fs/lib/MemoryFileSystem.js:288:4)
    at processImmediate (timers.js:632:19)

 ERROR  mocha-webpack exited with code 1.

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ventas-frontend@0.1.0 test:unit: `nyc vue-cli-service test:unit --require ./tests/unit/setup.js --timeout 10000`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ventas-frontend@0.1.0 test:unit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/benja/.npm/_logs/2019-06-24T16_19_47_171Z-debug.log

@iamahuman
Copy link

@silva96 Oops, my apologizes.

Can you do a vue-cli-service inspect and show its output? I don't know about how vue's complex webpack machinaries or its implicit rules go, and it also had tripped me a few times.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants