diff options
Diffstat (limited to 'test/lib/doctor.js')
-rw-r--r-- | test/lib/doctor.js | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/test/lib/doctor.js b/test/lib/doctor.js index f5e6fd062..820049347 100644 --- a/test/lib/doctor.js +++ b/test/lib/doctor.js @@ -120,18 +120,18 @@ const cacache = { }, } -const doctor = requireInject('../../lib/doctor.js', { +const Doctor = requireInject('../../lib/doctor.js', { '../../lib/utils/is-windows.js': false, '../../lib/utils/ping.js': ping, '../../lib/utils/output.js': (data) => { output.push(data) }, - '../../lib/npm.js': npm, cacache, pacote, 'make-fetch-happen': fetch, which, }) +const doctor = new Doctor(npm) const origVersion = process.version test('node versions', t => { @@ -162,7 +162,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { if (err) { st.fail(output) return st.end() @@ -211,7 +211,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { if (err) { st.fail(err) return st.end() @@ -255,7 +255,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { st.match(err, /Some problems found/, 'detected the ping error') st.match(logs, { checkPing: { finished: true }, @@ -282,18 +282,18 @@ test('node versions', t => { }) vt.test('npm doctor skips some tests in windows', st => { - const winDoctor = requireInject('../../lib/doctor.js', { + const WinDoctor = requireInject('../../lib/doctor.js', { '../../lib/utils/is-windows.js': true, '../../lib/utils/ping.js': ping, '../../lib/utils/output.js': (data) => { output.push(data) }, - '../../lib/npm.js': npm, cacache, pacote, 'make-fetch-happen': fetch, which, }) + const winDoctor = new WinDoctor(npm) const dir = st.testdir() npm.cache = npm.flatOptions.cache = dir @@ -312,7 +312,7 @@ test('node versions', t => { clearLogs() }) - winDoctor([], (err) => { + winDoctor.exec([], (err) => { if (err) { st.fail(output) return st.end() @@ -360,7 +360,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { st.match(err, /Some problems found/, 'detected the ping error') st.match(logs, { checkPing: { finished: true }, @@ -409,7 +409,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { st.match(err, /Some problems found/, 'detected the ping error') st.match(logs, { checkPing: { finished: true }, @@ -458,7 +458,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { st.match(err, /Some problems found/, 'detected the out of date npm') st.match(logs, { checkPing: { finished: true }, @@ -563,19 +563,19 @@ test('node versions', t => { } } - const doctor = requireInject('../../lib/doctor.js', { + const Doctor = requireInject('../../lib/doctor.js', { '../../lib/utils/is-windows.js': false, '../../lib/utils/ping.js': ping, '../../lib/utils/output.js': (data) => { output.push(data) }, - '../../lib/npm.js': npm, cacache, pacote, 'make-fetch-happen': fetch, which, fs, }) + const doctor = new Doctor(npm) // it's necessary to allow tests in node 10.x to not mark 12.x as lted npm.cache = npm.flatOptions.cache = join(dir, 'cache') @@ -600,7 +600,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { st.match(err, /Some problems found/, 'identified problems') st.match(logs, { checkPing: { finished: true }, @@ -653,7 +653,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { st.match(err, /Some problems found/, 'detected the missing git') st.match(logs, { checkPing: { finished: true }, @@ -706,7 +706,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { // cache verification problems get fixed and so do not throw an error if (err) { st.fail(output) @@ -765,7 +765,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { // cache verification problems get fixed and so do not throw an error if (err) { st.fail(output) @@ -823,7 +823,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { // cache verification problems get fixed and so do not throw an error if (err) { st.fail(output) @@ -878,7 +878,7 @@ test('node versions', t => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { // cache verification problems get fixed and so do not throw an error st.match(err, /Some problems found/, 'detected the non-default registry') st.match(logs, { @@ -942,7 +942,7 @@ test('outdated node version', vt => { clearLogs() }) - doctor([], (err) => { + doctor.exec([], (err) => { st.match(err, /Some problems found/, 'detected the out of date nodejs') st.match(logs, { checkPing: { finished: true }, |