Skip to content

Commit f1edffb

Browse files
committed
scripts: Modernize maketest
Credit: @iarna
1 parent fb3bbb7 commit f1edffb

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

scripts/maketest

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function generateFromDir (dir) {
2424
return `'use strict'
2525
const path = require('path')
2626
const test = require('tap').test
27-
const mr = require('npm-registry-mock')
2827
const Tacks = require('tacks')
2928
const File = Tacks.File
3029
const Symlink = Tacks.Symlink
@@ -48,7 +47,6 @@ const conf = {
4847
})
4948
}
5049
51-
let server
5250
const fixture = new Tacks(Dir({
5351
cache: Dir(),
5452
global: Dir(),
@@ -65,16 +63,12 @@ function cleanup () {
6563
fixture.remove(basedir)
6664
}
6765
68-
test('setup', function (t) {
66+
test('setup', t => {
6967
setup()
70-
mr({port: common.port, throwOnUnmatched: true}, function (err, s) {
71-
if (err) throw err
72-
server = s
73-
t.done()
74-
})
68+
return common.fakeRegistry.listen()
7569
})
7670
77-
test('example', function (t) {
71+
test('example', t => {
7872
common.npm(['install'], conf, function (err, code, stdout, stderr) {
7973
if (err) throw err
8074
t.is(code, 0, 'command ran ok')
@@ -85,8 +79,8 @@ test('example', function (t) {
8579
})
8680
})
8781
88-
test('cleanup', function (t) {
89-
server.close()
82+
test('cleanup', t => {
83+
common.fakeRegistry.close()
9084
cleanup()
9185
t.done()
9286
})\n`

0 commit comments

Comments
 (0)