我正在使用TypeScript和单元测试来开发一个刚刚创建的Vue cli项目。
我知道Vue cli测试使用mocha-webpack进行欠缺测试。当我在终端上键入mocha-webpack
时,测试运行正常。
但是我想使用mocha-test-explorer, a VS Code extension for mocha testing。为了获得更好的编程体验。
我安装了扩展程序,并进行了如下配置:
"mochaExplorer.files": "tests/**/*.ts",
"mochaExplorer.require": "ts-node/register"
但是我仍然看不到测试。 test-explorer显示轻松的输出:
(function (exports, require, module, __filename, __dirname) { import { expect } from 'chai'
^^^^^^
SyntaxError: Unexpected token import
我知道那是因为mocha不能通过webpack加载文件。
我应该怎么做才能在VSCode的mocha-webpack扩展名(或任何其他gui扩展名)中查看mocha-test-explorer测试?