Skip to content

Commit

Permalink
feat: switch to tap (#21)
Browse files Browse the repository at this point in the history
* feat: switch to tap

* drop t.end()
  • Loading branch information
gnought committed Feb 6, 2022
1 parent afe8d13 commit f9af10d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .taprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ts: false
jsx: false
flow: false
coverage: true
strict: true
check-coverage: false
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
"lint:fix": "standard --fix",
"lint:standard": "standard --verbose | snazzy",
"lint:markdown": "markdownlint docs/*.md README.md",
"unit": "tape test.js | faucet",
"test": "npm run lint && npm run unit",
"coverage": "nyc --reporter=lcov tape test.js",
"test:ci": "npm run lint && npm run coverage",
"test:ci": "npm run lint && npm run unit -- --cov --no-check-coverage --coverage-report=lcovonly",
"test:report": "npm run lint && npm run unit:report",
"unit": "tap -J test.js",
"unit:report": "tap -J test.js --cov --coverage-report=html --coverage-report=cobertura | tee out.tap",
"license-checker": "license-checker --production --onlyAllow=\"MIT;ISC;BSD-3-Clause;BSD-2-Clause\"",
"release": "read -p 'GITHUB_TOKEN: ' GITHUB_TOKEN && export GITHUB_TOKEN=$GITHUB_TOKEN && release-it --disable-metrics"
},
Expand All @@ -24,7 +25,7 @@
},
"hooks": {
"before:init": [
"npm run test"
"npm run test:ci"
]
},
"npm": {
Expand Down Expand Up @@ -55,16 +56,14 @@
},
"devDependencies": {
"aedes": "^0.46.2",
"faucet": "0.0.1",
"license-checker": "^25.0.1",
"markdownlint-cli": "^0.31.0",
"mqtt": "^4.3.4",
"nyc": "^15.1.0",
"pre-commit": "^1.2.2",
"qlobber": "^6.0.0",
"release-it": "^14.12.4",
"snazzy": "^9.0.0",
"standard": "^16.0.4",
"tape": "^5.5.0"
"tap": "^15.1.6"
}
}
12 changes: 1 addition & 11 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const test = require('tape').test
const { test } = require('tap')
const mqtt = require('mqtt')
const aedes = require('aedes')
const stats = require('./stats')
Expand Down Expand Up @@ -64,7 +64,6 @@ test('Connect a client and subscribe to get total number of clients', function (
t.ok(checkTopic(topic, sysTopic))
t.equal('1', message.toString(), 'clients connected')
subscriber.end()
t.end()
})
})

Expand All @@ -83,7 +82,6 @@ test('Connect a client and subscribe to get maximum number of clients', function
t.equal('2', message.toString(), 'clients connected')
subscriber.end()
additionalClient.end()
t.end()
})
})

Expand All @@ -102,7 +100,6 @@ test('Connect a client and subscribe to get current broker time', function (t) {
t.equal(s.instance.stats.time.toISOString(), message.toString(), 'current broker time')
subscriber.end()
additionalClient.end()
t.end()
})
})

Expand All @@ -120,7 +117,6 @@ test('Connect a client and subscribe to get broker up-time', function (t) {
const seconds = Math.round((s.instance.stats.time - s.instance.stats.started) / 1000)
t.equal(seconds.toString(), message.toString(), 'Broker uptime')
subscriber.end()
t.end()
})
})

Expand Down Expand Up @@ -156,7 +152,6 @@ test('Connect a client and and subscribe to get current heap usage', function (t
t.ok(checkTopic(topic, sysTopic))
t.pass(message.toString(), 'bytes of heap used currently')
subscriber.end()
t.end()
})
})

Expand All @@ -172,7 +167,6 @@ test('Connect a client and subscribe to get maximum heap usage', function (t) {
t.ok(checkTopic(topic, sysTopic))
t.pass(message.toString(), 'max bytes of heap used till now')
subscriber.end()
t.end()
})
})

Expand All @@ -188,7 +182,6 @@ test('Connect a client and subscribe to get cpu usage', function (t) {
t.ok(checkTopic(topic, sysTopic))
t.pass(message.toString(), 'cpu usage')
subscriber.end()
t.end()
})
})

Expand All @@ -204,7 +197,6 @@ test('Connect a client and subscribe to get cpu avg of last 1 min', function (t)
t.ok(checkTopic(topic, sysTopic))
t.pass(message.toString(), 'cpu avg of last 1 min')
subscriber.end()
t.end()
})
})

Expand All @@ -220,7 +212,6 @@ test('Connect a client and subscribe to get cpu avg of last 5 min', function (t)
t.ok(checkTopic(topic, sysTopic))
t.pass(message.toString(), 'cpu avg of last 5 min')
subscriber.end()
t.end()
})
})

Expand All @@ -236,6 +227,5 @@ test('Connect a client and subscribe to get cpu avg of last 15 min', function (t
t.ok(checkTopic(topic, sysTopic))
t.pass(message.toString(), 'cpu avg of last 15 min')
subscriber.end()
t.end()
})
})

0 comments on commit f9af10d

Please sign in to comment.