简体   繁体   中英

error “define is not defined” startup Istanbul

There is a project on "JavaScript" + "Node.JS" + "Ant".

Tests for JavaScript-code written in "Karma" + "Jasmine".

To assess the code coverage using "Istanbul".

The command:

istanbul cover someFile.js

an error:
"[path to the file]\\someFile.js:9
__cov_lhpa2MzHG9ur0fWhNQ3HsA.s['1']++;define('some',function(){__cov_lhpa2MzHG

ReferenceError: define is not defined"

Tell me, please, how to solve the problem?

UPD:

The code inside the file "someFile.js":

define('someFile', function() {

    describe("Base64", function () {

        it('Base64_TestEncode', function () {

            expect( "TXkgZW5nbGlzaCBiYWQ=" ).toEqual( $ws.single.base64.encode( "someText" ) );

        });

    });

});


UPD_2:

"define()" - method is related to the employee for RequireJS and to describe the modules.

Install amddefine pacakage using npm and then include global["define"] = require('amdefine') in ur gulp file.

Hope it will shortout ur issue. Worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM