javascript - jasmine-browser-runner rapporterar: Uncaught ReferenceError: exports är inte definierad
Jag använder Jasmine för enhetstestning av javascript/typescript-serverkod. Det fungerar som förväntat för testning via kommandoprompten. När jag använde jasmine-browser-runner (› npx jasmine-browser-runner) och startade webbläsaren, får jag:
0 specs, 0 failures, randomized with seed 00949
Error during loading: Uncaught ReferenceError: exports is not defined in http://localhost:8888/__spec__/test.spec.js line 2
Detta är innehållet i den enklaste test.spec.ts (kompilerad från TypeScript till JS):
import "jasmine";
describe("B suite", function () {
it("contains spec with an expectation", function () {
expect(true).toBe(true);
});
});
js :
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("jasmine");
describe("B suite", function () {
it("contains spec with an expectation", function () {
expect(true).toBe(true);
});
});
//# sourceMappingURL=test.spec.js.map
i tsconfig.json:
"target": "ES2015"
"module": "commonjs"
Någon idé? br