1 |
|
2 |
|
3 | var NYC = require('../')
|
4 |
|
5 | ;(new NYC()).wrap()
|
6 |
|
7 | // make it so we can run coverage on nyc.
|
8 | // turtles all the way down.
|
9 | var name = require.resolve('../')
|
10 | delete require.cache[name]
|
11 |
|
12 | // hide the fact that nyc.js was used to execute command.
|
13 | if (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
|
17 | if (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 | }
|