我完全卡住了:这是我的目录:

chutzpah.json
src/
--tests/
----example-test.ts
----test.js

//chutzpah.json
{
    "Framework": "mocha",
    "MochaInterface": "bdd",
    "TestHarnessReferenceMode": "AMD",
    "TestHarnessLocationMode": "SettingsFileAdjacent",
    "TypeScriptModuleKind": "AMD",
    "References" : [
        {"Path" : "../../libs/require.js" }, //present, not used yet
        { "Path": "../../node_modules/chai/chai.js", "IsTestFrameworkFile": "true" },
        {"Path" : "./config.js" } //blank, for future use
    ],
    "Tests" : [
      {"Path": "./src/tests"}
    ]
}

//示例-test.ts
mocha.setup('bdd');

var expect = chai.expect;
var assert = chai.assert;

describe("MODULE 1", function() {
    it("String doesnt equal number", function() {
        expect('2').to.not.equal(2);
    });
});

//test.js
var expect = chai.expect
describe("A test suite", function () {
    beforeEach(function () {
    });
    afterEach(function () {
    });
    it('should pass', function () {
        expect(true).to.be.true;
    });
});

为什么它不能在 Chutzpah/VS 的测试资源管理器中发现我的 example-test.ts?它确实找到了 test.js?

最佳答案

确保将 Visual Studio 插件设置为查找 .ts 文件。工具->选项-> Chutzpah->单元测试资源管理器:

关于c# - 如何让 Chutzpah 发现 Typescript 文件?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25413112/

10-13 05:53