Skip to content

Commit 523f008

Browse files
committed
Use Node test runner
1 parent 79ad667 commit 523f008

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ jobs:
1717
strategy:
1818
matrix:
1919
node:
20-
- lts/fermium
20+
- lts/hydrogen
2121
- node

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,13 @@
3838
"micromark-util-character": "^1.0.0"
3939
},
4040
"devDependencies": {
41-
"@types/tape": "^4.0.0",
41+
"@types/node": "^18.0.0",
4242
"c8": "^7.0.0",
4343
"hast-util-select": "^5.0.0",
4444
"hastscript": "^7.0.0",
4545
"prettier": "^2.0.0",
4646
"remark-cli": "^11.0.0",
4747
"remark-preset-wooorm": "^9.0.0",
48-
"tape": "^5.0.0",
4948
"type-coverage": "^2.0.0",
5049
"typescript": "^4.0.0",
5150
"xo": "^0.53.0"

test.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,59 @@
1-
import test from 'tape'
1+
import assert from 'node:assert/strict'
2+
import test from 'node:test'
23
import {h} from 'hastscript'
34
import {selectAll} from 'hast-util-select'
45
import {truncate} from './index.js'
56

6-
test('hastUtilTruncate', (t) => {
7-
t.deepEqual(
7+
test('hastUtilTruncate', () => {
8+
assert.deepEqual(
89
truncate(h('p', 'Lorem ipsum dolor sit amet'), {size: 11}),
910
h('p', 'Lorem ipsum'),
1011
'should truncate'
1112
)
1213

13-
t.deepEqual(
14+
assert.deepEqual(
1415
truncate(h('p', 'Lorem ipsum dolor sit amet'), {size: 10}),
1516
h('p', 'Lorem'),
1617
'should truncate to a nice break'
1718
)
1819

19-
t.deepEqual(
20+
assert.deepEqual(
2021
truncate(h('p', 'Lorem ipsum dolor sit amet'), {size: 4}),
2122
h('p', 'Lore'),
2223
'should truncate to an ugly break if there’s no perfect break'
2324
)
2425

25-
t.deepEqual(
26+
assert.deepEqual(
2627
truncate(h('p', 'Lorem ipsum dolor sit amet'), {size: 10, ellipsis: '…'}),
2728
h('p', 'Lorem…'),
2829
'should truncate w/ `ellipsis`'
2930
)
3031

31-
t.deepEqual(
32+
assert.deepEqual(
3233
truncate(h('p', 'Lorem ipsum dolor sit amet'), {size: 11}),
3334
h('p', 'Lorem ipsum'),
3435
'should truncate right to `size`, if that’s a perfect break'
3536
)
3637

37-
t.deepEqual(
38+
assert.deepEqual(
3839
truncate(h('p', 'Lorem ipsum dolor sit amet'), {size: 12}),
3940
h('p', 'Lorem ipsum'),
4041
'should truncate right to the wordbreak before `size`, if that points to whitespace'
4142
)
4243

43-
t.deepEqual(
44+
assert.deepEqual(
4445
truncate(h('p', 'Lorem ipsum, dolor sit amet'), {size: 11}),
4546
h('p', 'Lorem ipsum'),
4647
'should truncate right to the wordbreak before `size`, if that points to punctuation'
4748
)
4849

49-
t.deepEqual(
50+
assert.deepEqual(
5051
truncate(h('p', 'Lorem ipsum, dolor sit amet'), {size: 12}),
5152
h('p', 'Lorem ipsum,'),
5253
'should truncate right to the punctuation at `size`, if that points to whitespace'
5354
)
5455

55-
t.deepEqual(
56+
assert.deepEqual(
5657
truncate(h('p', 'Lorem ipsum dolor sit amet'), {
5758
size: 10,
5859
maxCharacterStrip: 0
@@ -67,7 +68,7 @@ test('hastUtilTruncate', (t) => {
6768
' adipisicing elit'
6869
])
6970

70-
t.deepEqual(
71+
assert.deepEqual(
7172
truncate(
7273
h('p', [
7374
'Lorem ipsum dolor sit amet, ',
@@ -83,11 +84,9 @@ test('hastUtilTruncate', (t) => {
8384
'should copy elements'
8485
)
8586

86-
t.deepEqual(
87+
assert.deepEqual(
8788
truncate(tree, {ignore: selectAll('del', tree)}),
8889
h('p', ['Lorem ipsum dolor sit amet, ', ' adipisicing elit']),
8990
'should truncate w/ `ignore`'
9091
)
91-
92-
t.end()
9392
})

0 commit comments

Comments
 (0)