Skip to content

Commit e6c8c52

Browse files
authored
test: convert runner from mocha to node --test (#74)
1 parent b7d18da commit e6c8c52

File tree

5 files changed

+17
-22
lines changed

5 files changed

+17
-22
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
44

55
### Unreleased
66

7+
- test: convert runner from mocha to node --test
8+
79
### [2.2.3] - 2025-01-13
810

911
- dep(eslint): upgrade to v9

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"lint:fix": "npx eslint *.js test --fix",
2323
"prettier": "npx prettier . --check",
2424
"prettier:fix": "npx prettier . --write --log-level=warn",
25-
"test": "npx mocha@10",
25+
"test": "node --test",
2626
"versions": "npx dependency-version-checker check",
2727
"versions:fix": "npx dependency-version-checker update && npm run prettier:fix"
2828
},
@@ -31,7 +31,7 @@
3131
"url": "https://github.com/haraka/node-address-rfc2822.git"
3232
},
3333
"devDependencies": {
34-
"@haraka/eslint-config": "2.0.2"
34+
"@haraka/eslint-config": "^2.0.2"
3535
},
3636
"license": "MIT",
3737
"dependencies": {

test/Address.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const assert = require('node:assert/strict')
2+
const { describe, it } = require('node:test');
23

34
const address = require('../index')
45

test/basic.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const assert = require('node:assert/strict')
2+
const { describe, it } = require('node:test');
23
const fs = require('fs')
34
const path = require('path')
45

test/functions.js

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,35 @@
11
const assert = require('assert')
2+
const { describe, it } = require('node:test');
23

34
const address = require('../index')
45

56
describe('isAllLower', function () {
6-
it('lower latin string', function (done) {
7+
it('lower latin string', function () {
78
assert.equal(true, address.isAllLower('abcdefg'))
8-
done()
99
})
1010
})
1111

1212
describe('isAllUpper', function () {
13-
it('upper latin string', function (done) {
13+
it('upper latin string', function () {
1414
assert.equal(true, address.isAllUpper('ABCDEFG'))
15-
done()
1615
})
1716
})
1817

1918
describe('nameCase', function () {
20-
it('john doe -> John Doe', function (done) {
19+
it('john doe -> John Doe', function () {
2120
assert.equal('John Doe', address.nameCase('john doe'))
22-
done()
2321
})
24-
it('JANE SMITH -> Jane Smith', function (done) {
22+
it('JANE SMITH -> Jane Smith', function () {
2523
assert.equal('Jane Smith', address.nameCase('JANE SMITH'))
26-
done()
2724
})
28-
it('marty mcleod -> Marty McLeod', function (done) {
25+
it('marty mcleod -> Marty McLeod', function () {
2926
assert.equal('Marty McLeod', address.nameCase('marty mcleod'))
30-
done()
3127
})
32-
it("martin o'mally -> Martin O'Malley", function (done) {
28+
it("martin o'mally -> Martin O'Malley", function () {
3329
assert.equal("Martin O'Malley", address.nameCase("martin o'malley"))
34-
done()
3530
})
36-
it('level iii support -> Level III Support', function (done) {
31+
it('level iii support -> Level III Support', function () {
3732
assert.equal('Level III Support', address.nameCase('level iii support'))
38-
done()
3933
})
4034
})
4135

@@ -82,7 +76,7 @@ describe('parseSender', function () {
8276
})
8377

8478
describe('parseReplyTo', function () {
85-
it('=?utf-8?Q?Anne=20Standley=2C=20Protect=20My=20Public=20Media?= <[email protected]>', function (done) {
79+
it('=?utf-8?Q?Anne=20Standley=2C=20Protect=20My=20Public=20Media?= <[email protected]>', function () {
8680
try {
8781
const r = address.parseReplyTo(
8882
'=?utf-8?Q?Anne=20Standley=2C=20Protect=20My=20Public=20Media?= <[email protected]>',
@@ -97,21 +91,19 @@ describe('parseReplyTo', function () {
9791
} catch (e) {
9892
console.error(e)
9993
}
100-
done()
10194
})
10295
})
10396

10497
describe('parse with options', function () {
105-
it('should not allow parsing display name with comma by default', function (done) {
98+
it('should not allow parsing display name with comma by default', function () {
10699
try {
107100
address.parse('Foo, Bar <[email protected]>')
108101
} catch (e) {
109102
assert.equal(e.message, 'No results')
110103
}
111-
done()
112104
})
113105

114-
it('should allow parsing display name with comma', function (done) {
106+
it('should allow parsing display name with comma', function () {
115107
try {
116108
const [r] = address.parse('Foo, Bar <[email protected]>', {
117109
allowCommaInDisplayName: true,
@@ -121,6 +113,5 @@ describe('parse with options', function () {
121113
} catch (e) {
122114
console.error(e)
123115
}
124-
done()
125116
})
126117
})

0 commit comments

Comments
 (0)