diff options
Diffstat (limited to 'deps/npm/test/lib/load-all.js')
-rw-r--r-- | deps/npm/test/lib/load-all.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/deps/npm/test/lib/load-all.js b/deps/npm/test/lib/load-all.js new file mode 100644 index 0000000000..72879c2c44 --- /dev/null +++ b/deps/npm/test/lib/load-all.js @@ -0,0 +1,30 @@ +const t = require('tap') +const glob = require('glob') +const { resolve } = require('path') + +const full = process.env.npm_lifecycle_event === 'check-coverage' + +if (!full) { + t.pass('nothing to do here, not checking for full coverage') +} else { + // some files do config.get() on load, so have to load npm first + const npm = require('../../lib/npm.js') + t.test('load npm first', t => npm.load(t.end)) + + t.test('load all the files', t => { + // just load all the files so we measure coverage for the missing tests + const dir = resolve(__dirname, '../../lib') + for (const f of glob.sync(`${dir}/**/*.js`)) { + require(f) + t.pass('loaded ' + f) + } + t.pass('loaded all files') + t.end() + }) + + t.test('call the error handle so we dont freak out', t => { + const errorHandler = require('../../lib/utils/error-handler.js') + errorHandler() + t.end() + }) +} |