I have the following Jasmine test in a TypeScript file in a VS2017 project:
describe("A trivial test", () => {
it("Should pass", () => {
expect(true).toBeTruthy();
});
});
This runs using the ReSharper runner, and all is well.
Then I add
import { TestedObject } from "./TestedModule";
to the top of the file.
This time when trying to run the test, ReSharper reports:
Ignored: Task skipped on timeout
Jasmine reports:
No specs found
and opening the browser console I see:
Uncaught ReferenceError: define is not defined
Looking at the error location I see the the transpiled TypeScript hoping to use RequireJS AMD module loading (as configured in tsconfig.json):
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TestedObject = (function () {
function TestedObject() {
this.magicNumber = 3;
}
return TestedObject;
}());
exports.TestedObject = TestedObject;
});
However, RequireJS is not loaded and so far I have not found how to load it to make it available in this scenario.
I feel this could be a one-liner (if you know which line, where) but can anyone point me in the right direction for either making RequireJS available to the tests, or an alternative setup that will allow me to use ReSharper to run the tests?