"mocha-typescript": "^1.1.17",
"@types/chai": "^4.1.7",
"convict": "^4.4.1",
"sinon": "^7.3.2",
"inversify": "^5.0.1",
我的应用程序是用来测试罪犯是否正常运行,我已经设置了一个这样的类来测试罪犯并使用sinon对其进行存根测试。
请参见下面的示例:
import convict from 'convict';
import { injectable } from 'inversify';
@injectable();
export class convictGood {
abc: any;
constructor(@inject('Config') config: Config) {
this.abc = convict( schema);
}
public default( str: string) {
return this.abc.default( str );
}
}
我曾尝试用mocha-typescript进行测试
import { assert } from "chai";
import sinon from 'sinon';
import "mocha";
import {convictGood} from './convictGood.ts';
@suite
export class TestIt() {
@test
public default() {
const name:any = {
fake: {
default: 'fake name'
}
};
const result = .default( name );
}
}
结果失败,我无法测试。
这是下面的错误消息,我正在寻找一些问题,但仍然对我不起作用。
How to fix "Uncaught TypeError: $(...).validate is not a function"?
TypeError: path.split is not a function
at Object.default (node_modules/convict/lib/convict.js:552:20)