alex-seville / grunt-blanket

grunt task to instrument files for code coverage using Blanket.js
http://blanketjs.org
MIT License
29 stars 6 forks source link

bad file instrument indicator #4

Closed jmgunn87 closed 11 years ago

jmgunn87 commented 11 years ago

Hi,

I am using the config described in the example,

grunt.initConfig({
  blanket: {
    options: {},
    files: {
      'src-cov/': ['src/'],
    },
  },
})

I get the exception "Bad file instrument indicator. Must be a string, regex, function, or array". There are scripts in my src folder.

the error is thrown at blanket/src/index.js:94

thanks

alex-seville commented 11 years ago

Which version?

jmgunn87 commented 11 years ago

0.0.6

alex-seville commented 11 years ago

Ah, I found the issue. I'll try to get a patch together tonight.

jmgunn87 commented 11 years ago

excellent. thank you.

alex-seville commented 11 years ago

I think it's because a target is required:

blanket: {
      instrument: {
        options: {
        },
        files: {
          'src-cov/': ['src/'],
        },
      }
    },
jmgunn87 commented 11 years ago

unfortunately no. I tried that already. I will have a look through source also and see if I can help find out why this is happening. BTW I noticed it is generating coverage files but still throwing an exception which is breaking the grunt task chain.

jmgunn87 commented 11 years ago

ok, very strange. If a make blanket the last task in my multi-task then everything works fine. If I add any other tasks afterwards i get the exception.

grunt.registerTask('default', ['jshint', 'jasmine', 'blanket']); // OK
grunt.registerTask('default', ['jshint', 'jasmine', 'blanket', 'uglify']) // Exception
alex-seville commented 11 years ago

Ah, I know why this is. Blanket is not disengaging it's instrumentation, so it's trying to instrument your other task files. I should be able to resolve this tomorrow.

On Mon, Apr 29, 2013 at 9:47 PM, James Marshall-Gunn < notifications@github.com> wrote:

ok, very strange. If a make blanket the last task in my multi-task then everything works fine. If I add any other tasks afterwards i get the exception.

— Reply to this email directly or view it on GitHubhttps://github.com/alex-seville/grunt-blanket/issues/4#issuecomment-17209413 .

jmgunn87 commented 11 years ago

I have a fix now. which branch can/do i push to(i have forked blanket and will need to fork this repo, as the fix spans both repositories)?

alex-seville commented 11 years ago

thanks for the PR, I've added some comments on it though.

On Mon, Apr 29, 2013 at 10:54 PM, James Marshall-Gunn < notifications@github.com> wrote:

I have a fix now. which branch can/do i push to?

— Reply to this email directly or view it on GitHubhttps://github.com/alex-seville/grunt-blanket/issues/4#issuecomment-17210701 .

jmgunn87 commented 11 years ago

np, the committed files list looks a bit long, I branched off from 1.1.2 as this is more of a patch than a feature is this correct? Can't see any commits on the PR aswell..

alex-seville commented 11 years ago

I added comments onto the PR itself. v1.1.4 is the current dev branch.

jmgunn87 commented 11 years ago

sorry, I'm probably being simple here but I still cant see them. Is this good to merge or shall I redo this?

jmgunn87 commented 11 years ago

can we bump the blanket version in the package.json and change tasks/blanket.js:57 to

function () {
  blkt.restoreNormalLoader();
  done();
});
alex-seville commented 11 years ago

Done, and updated in npm.

jmgunn87 commented 11 years ago

awesome! thanks

On Thu, May 2, 2013 at 4:11 PM, Alex Seville notifications@github.comwrote:

Done, and updated in npm.

— Reply to this email directly or view it on GitHubhttps://github.com/alex-seville/grunt-blanket/issues/4#issuecomment-17343746 .

alex-seville commented 11 years ago

Let me know if the updates resolve the issue (I tested it, but not exhaustively)

jmgunn87 commented 11 years ago

Yes all sorted this end good job

On Thursday, May 2, 2013, Alex Seville wrote:

Let me know if the updates resolve the issue (I tested it, but not exhaustively)

— Reply to this email directly or view it on GitHubhttps://github.com/alex-seville/grunt-blanket/issues/4#issuecomment-17357289 .

alex-seville commented 11 years ago

Thanks for the contributions.