UNPKG

587 BJavaScriptView Raw
1#!/usr/bin/env node
2
3var NYC = require('../')
4
5;(new NYC()).wrap()
6
7// make it so we can run coverage on nyc.
8// turtles all the way down.
9var name = require.resolve('../')
10delete require.cache[name]
11
12// hide the fact that nyc.js was used to execute command.
13if (process.argv[1].match((/(nyc.js$)|(nyc$)/))) process.argv.splice(1, 1)
14
15// execute main on the file passed to nyc:
16// ./bin/nyc.js ./node_modules/.bin/mocha
17if (process.argv[1]) {
18 delete require('module')._cache[process.argv[1]]
19 process.argv[1] = require('path').resolve(process.argv[1])
20 require('module').runMain()
21}