Rxjs Mocha 测试不会在 WebStorm 上 运行

Rxjs Mocha tests will not run on WebStorm

我一直在尝试从 WebStorm 上的 rxjs 存储库中获取规范测试 运行ning IDE。

https://github.com/ReactiveX/rxjs.git

问题是我可以 运行 使用包含的脚本进行测试,并通过命令行手动进行测试,但无法配置 WebStorm。

以下是我最常收到的错误消息。我已经包含了 Mocha 的默认 opts 文件,下面是结果。

ReferenceError: asDiagram is not defined
    at Suite.<anonymous> (/Users/test/Desktop/Test/rxjs/spec/Observable-spec.ts:636:3)
    at Object.create (/Users/test/Desktop/Test/rxjs/node_modules/mocha/lib/interfaces/common.js:112:19)
    at context.describe.context.context (/Users/test/Desktop/Test/rxjs/node_modules/mocha/lib/interfaces/bdd.js:44:27)
    at Object.<anonymous> (/Users/test/Desktop/Test/rxjs/spec/Observable-spec.ts:635:1)
    at Module._compile (module.js:652:30)
    at Module.m._compile (/Users/test/Desktop/Test/rxjs/node_modules/ts-node/src/index.ts:430:23)
    at Module._extensions..js (module.js:663:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/test/Desktop/Test/rxjs/node_modules/ts-node/src/index.ts:433:12)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)

出现问题是因为 Webstorm 将 --ui bdd 传递给 mocha,覆盖了 spec/support/default.opts 中指定的自定义 ui。要解决此问题,您必须更改 User interface: 选项 Mocha 运行 配置中的默认设置(bdd ) 到您的自定义字段 (spec/helpers/testScheduler-ui.ts) - 字段是可编辑的,您可以 type/paste 值。适合我的配置: