Skip to content

Commit

Permalink
scripts: Modernize maketest
Browse files Browse the repository at this point in the history
Credit: @iarna
  • Loading branch information
iarna committed Dec 19, 2018
1 parent fb3bbb7 commit f1edffb
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions scripts/maketest
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function generateFromDir (dir) {
return `'use strict'
const path = require('path')
const test = require('tap').test
const mr = require('npm-registry-mock')
const Tacks = require('tacks')
const File = Tacks.File
const Symlink = Tacks.Symlink
Expand All @@ -48,7 +47,6 @@ const conf = {
})
}
let server
const fixture = new Tacks(Dir({
cache: Dir(),
global: Dir(),
Expand All @@ -65,16 +63,12 @@ function cleanup () {
fixture.remove(basedir)
}
test('setup', function (t) {
test('setup', t => {
setup()
mr({port: common.port, throwOnUnmatched: true}, function (err, s) {
if (err) throw err
server = s
t.done()
})
return common.fakeRegistry.listen()
})
test('example', function (t) {
test('example', t => {
common.npm(['install'], conf, function (err, code, stdout, stderr) {
if (err) throw err
t.is(code, 0, 'command ran ok')
Expand All @@ -85,8 +79,8 @@ test('example', function (t) {
})
})
test('cleanup', function (t) {
server.close()
test('cleanup', t => {
common.fakeRegistry.close()
cleanup()
t.done()
})\n`
Expand Down

0 comments on commit f1edffb

Please sign in to comment.