Niels Steenbeek
Niels Steenbeek

Reputation: 4834

Test Babel transpiled(AMD) ES6 code in Karma + Jasmine

I have written test in ES6, which is transpiled to ES5 in AMD format using Babel. Now I want to run the test using Karma(+requirejs) and Jasmine, but getting following error:

Error: Mismatched anonymous define() module: function (exports) {
    "use strict";

    describe("App", function () {
        it("tests something", function () {
            expect(true).toBe(true);
        });
    });
}

The test file looks like:

define(["exports"], function (exports) {
    "use strict";

    describe("App", function () {
        it("tests something", function () {
            expect(true).toBe(true);
        });
    });
});
//# sourceMappingURL=app.js.map

Upvotes: 2

Views: 377

Answers (1)

Niels Steenbeek
Niels Steenbeek

Reputation: 4834

I'm not transpiling to ES5 first, but use karma-babel-preprocessor.

Upvotes: 0

Related Questions