A. L
A. L

Reputation: 12649

mocha-webpack not finding tests

I can't seem to figure how to get mocha-webpack to detect tests in my folder. I'm running the following command:

mocha-webpack --webpack-config test/server/webpack.config-test.js

webpack.config-test.js

var nodeExternals = require("webpack-node-externals")
const path = require("path")

function resolve(dir) 
{
    return path.join(__dirname, "..", dir)
}

module.exports = {
    context: path.resolve(__dirname),
    resolve: {
        extensions: [".js"],
        alias: {
            "vue$": "vue/dist/vue.esm.js",
            "@": resolve("src"),
        }
    },
    target: "node", // webpack should compile node compatible code
    externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
}

If it helps, I'm also using vue-cli, so there are already webpack configs, and maybe I could just import one of them then do slight changes.

Upvotes: 1

Views: 1081

Answers (1)

Rodrigo Mata
Rodrigo Mata

Reputation: 1859

You need to add this to your line of code:

mocha-webpack --webpack-config test/server/webpack.config-test.js \"src/**/*.js\"

Upvotes: 1

Related Questions