diff options
Diffstat (limited to 'deps/npm/test/lib/load-all.js')
-rw-r--r-- | deps/npm/test/lib/load-all.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/deps/npm/test/lib/load-all.js b/deps/npm/test/lib/load-all.js index e6e40780534..c38c244934e 100644 --- a/deps/npm/test/lib/load-all.js +++ b/deps/npm/test/lib/load-all.js @@ -1,15 +1,24 @@ const t = require('tap') const glob = require('glob') const { resolve } = require('path') +const { real: mockNpm } = require('../fixtures/mock-npm') 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)) + const { npm } = mockNpm(t) + + t.teardown(() => { + const exitHandler = require('../../lib/utils/exit-handler.js') + exitHandler.setNpm(npm) + exitHandler() + }) + + t.test('load npm first', async t => { + await npm.load() + }) t.test('load all the files', t => { // just load all the files so we measure coverage for the missing tests @@ -21,11 +30,4 @@ else { t.pass('loaded all files') t.end() }) - - t.test('call the exit handler so we dont freak out', t => { - const exitHandler = require('../../lib/utils/exit-handler.js') - exitHandler.setNpm(npm) - exitHandler() - t.end() - }) } |