Welcome to mirror list, hosted at ThFree Co, Russian Federation.

webpack.coverage.js - github.com/nasa/openmct.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3d96130a25d9174da6f0edf4cc9aaf0293c9a28a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// This file extends the webpack.dev.js config to add istanbul coverage
// instrumentation using babel-plugin-istanbul (see babel.coverage.js)

const config = require('./webpack.dev');

const path = require('path');

const vueLoaderRule = config.module.rules.find(r => r.use === 'vue-loader');

vueLoaderRule.use = {
    loader: 'vue-loader'
    // Attempt to use Babel with babel-plugin-istanbul

    // TODO The purpose of this was to try to add coverage to JS expressions
    // inside `<template>` markup, but it seems to add only coverage inside
    // `<script>` tags.
    // Issue: https://github.com/nasa/openmct/issues/4973
    //
    // options: {
    //     compiler: require('vue-template-babel-compiler'),
    //     compilerOptions: {
    //         babelOptions: require('./babel.coverage')
    //     }
    // }
};

config.module.rules.push({
    test: /\.js$/,
    // test: /(\.js$)|(\?vue&type=template)/,
    // exclude: /node_modules(?!.*\.vue)/,
    exclude: /(Spec\.js$)|(node_modules)/,
    use: {
        loader: 'babel-loader',
        options: {
            // eslint-disable-next-line no-undef
            configFile: path.resolve(process.cwd(), 'babel.coverage.js')
        }
    }
});

module.exports = config;