Coder Social home page Coder Social logo

Comments (21)

NedalKouissi avatar NedalKouissi commented on July 18, 2024

@alex-seville, what up brother !

from blanket.

thom4parisot avatar thom4parisot commented on July 18, 2024

I encountered this issue as well and reverted to 1.1.9 too to make it work.

from blanket.

westy92 avatar westy92 commented on July 18, 2024

I just experienced this same error. What are you reverting to version 1.9.1?

from blanket.

NedalKouissi avatar NedalKouissi commented on July 18, 2024

@westy92 npm install --save-dev [email protected], you may need sudo :)

from blanket.

westy92 avatar westy92 commented on July 18, 2024

If 1.2.1 is the latest version, how can 1.9.1 exist? Something doesn't add up. Do you mean 1.1.9?

from blanket.

NedalKouissi avatar NedalKouissi commented on July 18, 2024

@westy92 yes you're right!

from blanket.

alex-seville avatar alex-seville commented on July 18, 2024

I've published a new version, 1.2.2. Let me know if it changes anything.

from blanket.

thom4parisot avatar thom4parisot commented on July 18, 2024

Hm sadly I still encounter the issue with [email protected]. Here is the trace:

> mocha -r env-test -r blanket -R html-cov test/*.js > coverage.html

/Users/oncletom/workspace/freebird/feed-parser/node_modules/blanket/src/index.js:179
                            throw e;
                            ^

Error: BLANKET-Error parsing instrumented code: ReferenceError: _$jscoverage is not defined
    at /Users/oncletom/workspace/freebird/feed-parser/node_modules/blanket/src/index.js:177:37
    at Object.__dirname.blanket._blanket.instrumentSync (/Users/oncletom/workspace/freebird/feed-parser/node_modules/blanket/src/blanket.js:134:21)
    at Object.__dirname.blanket._blanket.instrument (/Users/oncletom/workspace/freebird/feed-parser/node_modules/blanket/src/blanket.js:141:22)
    at Object.require.extensions..js (/Users/oncletom/workspace/freebird/feed-parser/node_modules/blanket/src/index.js:158:25)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/oncletom/workspace/freebird/feed-parser/test/parse-feed.js:3:11)
    at Module._compile (module.js:410:26)
    at Module._extensions..js (module.js:417:10)
    at Object.require.extensions..js (/Users/oncletom/workspace/freebird/feed-parser/node_modules/blanket/src/index.js:144:17)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at /Users/oncletom/workspace/freebird/feed-parser/node_modules/mocha/lib/mocha.js:219:27
    at Array.forEach (native)
    at Mocha.loadFiles (/Users/oncletom/workspace/freebird/feed-parser/node_modules/mocha/lib/mocha.js:216:14)
    at Mocha.run (/Users/oncletom/workspace/freebird/feed-parser/node_modules/mocha/lib/mocha.js:468:10)
    at Object.<anonymous> (/Users/oncletom/workspace/freebird/feed-parser/node_modules/mocha/bin/_mocha:403:18)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

And a partial npm ls:

├─┬ [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]

from blanket.

ufocoder avatar ufocoder commented on July 18, 2024

+1

from blanket.

alex-seville avatar alex-seville commented on July 18, 2024

Hmm, it's working on travis CI at [email protected] - https://travis-ci.org/alex-seville/blanket/jobs/110242642

from blanket.

vaunus avatar vaunus commented on July 18, 2024

Same issue here when trying to use "use strict"; at the top of some of my project files using blanket 1.2.2.

A very simple example of this:
test.js:

let abc = 123;

Error: BLANKET-Error parsing instrumented code: SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Fine, so I add use strict:
test.js:

'use strict';
let abc = 123;

And the output:

# mocha --require blanket test.js
/Volumes/workspace/sss/mobile-api/node_modules/blanket/src/index.js:179
                            throw e;
                            ^

Error: BLANKET-Error parsing instrumented code: ReferenceError: _$jscoverage is not defined
    at /Volumes/workspace/sss/mobile-api/node_modules/blanket/src/index.js:177:37
    at Object.__dirname.blanket._blanket.instrumentSync (/Volumes/workspace/sss/mobile-api/node_modules/blanket/src/blanket.js:134:21)
    at Object.__dirname.blanket._blanket.instrument (/Volumes/workspace/sss/mobile-api/node_modules/blanket/src/blanket.js:141:22)
    at Object.require.extensions..js (/Volumes/workspace/sss/mobile-api/node_modules/blanket/src/index.js:158:25)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at /Volumes/workspace/sss/mobile-api/node_modules/mocha/lib/mocha.js:219:27
    at Array.forEach (native)
    at Mocha.loadFiles (/Volumes/workspace/sss/mobile-api/node_modules/mocha/lib/mocha.js:216:14)
    at Mocha.run (/Volumes/workspace/sss/mobile-api/node_modules/mocha/lib/mocha.js:468:10)
    at Object.<anonymous> (/Volumes/workspace/sss/mobile-api/node_modules/mocha/bin/_mocha:403:18)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:141:18)
    at node.js:933:3

Snippet from my package.json:

"blanket": {
  "pattern": "///[\\w-_]+\\.js$/",
    "data-cover-never": [
      "/node_modules/",
      "/test/"
    ],
    "data-cover-ecmaVersion": 6,
    "data-cover-reporter-options": {
      "relativepath": true
    }
}

Tested on various versions of Node 4 and 5.

from blanket.

alex-seville avatar alex-seville commented on July 18, 2024

Sounds like you're using ES6, you'll need to let Blanket know:
https://github.com/alex-seville/blanket/blob/master/docs/options.md#data-cover-ecmaversion

from blanket.

vaunus avatar vaunus commented on July 18, 2024

I have already let Blanket know I'm using ES6. See the snippet from my package.json above which has the "data-cover-ecmaVersion": 6 parameter.

We are using ES6 throughout our codebase but have had to wrap most ES6 files in a function wrapper to get Blanket to work. This doesn't work for top-level files however such as app.js. As soon as I add "use strict"; to this I get this error so we are unable to use ES6 features in these files.

I can reproduce this in a simple example:
test.js:

var abc = 123;
mocha --require blanket test.js 
  0 passing (2ms)

However:
test.js:

'use strict';
var abc = 123;
# mocha --require blanket test.js 
/usr/local/lib/node_modules/blanket/src/index.js:179
                            throw e;
                            ^

Error: BLANKET-Error parsing instrumented code: ReferenceError: _$jscoverage is not defined
    at /usr/local/lib/node_modules/blanket/src/index.js:177:37
    at Object.__dirname.blanket._blanket.instrumentSync (/usr/local/lib/node_modules/blanket/src/blanket.js:134:21)
    at Object.__dirname.blanket._blanket.instrument (/usr/local/lib/node_modules/blanket/src/blanket.js:141:22)
    at Object.require.extensions..js (/usr/local/lib/node_modules/blanket/src/index.js:158:25)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at /usr/local/lib/node_modules/mocha/lib/mocha.js:219:27
    at Array.forEach (native)
    at Mocha.loadFiles (/usr/local/lib/node_modules/mocha/lib/mocha.js:216:14)
    at Mocha.run (/usr/local/lib/node_modules/mocha/lib/mocha.js:468:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:403:18)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:141:18)
    at node.js:933:3

from blanket.

abienkowski avatar abienkowski commented on July 18, 2024

This is has been around for a long time, originally report Dec.2013.

I need to run npm install [email protected] to make my tests run.

from blanket.

markvandenbrink avatar markvandenbrink commented on July 18, 2024

Same problem here (_$jscoverage is not defined) when using 1.2.1 or 1.2.2. Reverting back to 1.1.9 as workaround.

from blanket.

frankred avatar frankred commented on July 18, 2024

Same with me...

from blanket.

sbefort avatar sbefort commented on July 18, 2024

Same with me...

from blanket.

rlk833 avatar rlk833 commented on July 18, 2024

Same here. Busted. We absolutely need ecmaVersion 6. Tried going to a lower version and other problems occur because of no ecmaVersion 6 support.

from blanket.

kousha-icracked avatar kousha-icracked commented on July 18, 2024

I'm having the same problem when using ES6. Running 1.1.9 causes another problem:

Error: BLANKET-Error parsing instrumented code: Error: BLANKET-Error parsing instrumented code: Error: BLANKET-Error parsing instrumented code: Error: Line 17: Unexpected token )

Anyone has a solution?

from blanket.

rbudiharso avatar rbudiharso commented on July 18, 2024

I'm having this problem too with blanket 1.2.3

from blanket.

selfagency avatar selfagency commented on July 18, 2024

I too am having this problem with 1.2.3 using es6

> [email protected] test /Users/ds/Dev/nylon-web
> multi='dot=- html-cov=coverage.html' ./node_modules/mocha/bin/mocha -r blanket --reporter mocha-multi --no-colors "src/app/app.js"

/Users/ds/Dev/nylon-web/node_modules/blanket/src/index.js:180
                            throw e;
                            ^

Error: BLANKET-Error parsing instrumented code: ReferenceError: _$jscoverage is not defined
    at /Users/ds/Dev/nylon-web/node_modules/blanket/src/index.js:178:37
    at Object.__dirname.blanket._blanket.instrumentSync (/Users/ds/Dev/nylon-web/node_modules/blanket/src/blanket.js:134:21)
    at Object.__dirname.blanket._blanket.instrument (/Users/ds/Dev/nylon-web/node_modules/blanket/src/blanket.js:141:22)
    at Object.require.extensions..js (/Users/ds/Dev/nylon-web/node_modules/blanket/src/index.js:159:25)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at /Users/ds/Dev/nylon-web/node_modules/mocha/lib/mocha.js:222:27
    at Array.forEach (native)
    at Mocha.loadFiles (/Users/ds/Dev/nylon-web/node_modules/mocha/lib/mocha.js:219:14)
    at Mocha.run (/Users/ds/Dev/nylon-web/node_modules/mocha/lib/mocha.js:487:10)
    at Object.<anonymous> (/Users/ds/Dev/nylon-web/node_modules/mocha/bin/_mocha:459:18)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:148:18)
    at node.js:405:3

from blanket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.