【发布时间】:2017-11-15 07:57:57
【问题描述】:
import {describe, it} from 'mocha'
import {expect} from "chai"
describe('Example Mocha Test 1', function () {
it('Should test foo', function () {
let foo = 'bar'
expect(foo, 'because foo is str').to.be.a('string')
})
})
得到错误:
Module '"mocha"' has no exported member 'describe'. (2305)
Module '"mocha"' has no exported member 'it'. (2305)
这种导入方式昨天有效,所以我将整个项目更改为这种格式,今天突然决定不工作。
我之所以要导入describe 和it 是因为当我这样导入时IDE(WebStorm)开始自动完成。
当我将代码更改为:
import 'mocha'
代码编译并再次开始运行测试。但我没有得到自动完成。
我安装了"@types/mocha": "2.2.44",。
我该怎么办?
【问题讨论】:
标签: typescript mocha.js webstorm