How to watch mocha-webpack tests results in mocha-test-explorer VS Code Extension?

573 Views Asked by At

I'm working on a just created Vue cli project with TypeScript and unit testing.

I Know that Vue cli tests uses mocha-webpack to runt tests. And when I Type mocha-webpack on terminal, the tests runs ok.

But I would like to use an mocha-test-explorer, a VS Code extension for mocha testing. For a better programming experience.

I Installed the extension and configured like this:

"mochaExplorer.files": "tests/**/*.ts",
"mochaExplorer.require": "ts-node/register"

But I'm still not able to see the tests. test-explorer shows the fallowing output:

(function (exports, require, module, __filename, __dirname) { import { expect } from 'chai'
                                                              ^^^^^^
SyntaxError: Unexpected token import

I know that is because mocha is not loading files through webpack.

What should I do to see mocha-webpack tests in the mocha-test-explorer extension (or any other gui extension) for VSCode?

0

There are 0 best solutions below