substack/coverify — pull request #8 by kirbysayshi (2014-02-07 01:35:55+00:00)
Title: require('./package.json') causes coverify transform to fail

Doing something like:

```js
var pkg = require('./package')

module.exports = function (cb) {
var i = 0;
var iv = setInterval(function () {
if (i++ === 10 || (false && neverFires())) {
clearInterval(iv);
cb(null, 111);
}
}, 10);
};
```

in `foo.js` and then running:

```
$ node_modules/browserify/bin/cmd.js -t coverify test.js --bare
```

Will output:
```
Error: Unexpected token :

/Users/drewp/dev/coverify-test/package.json:2
"name": "coverify-test",
^
```

This is because the coverify transform is attempting to parse the `package.json` as JS and not JSON. But it's weird that a transform would have to worry about every single type of file passing through the pipeline. Should this check happen within coverify, or within browserify itself?