Skip to content

Commit 3d2b533

Browse files
committed
Use Node test runner
1 parent cc69959 commit 3d2b533

File tree

3 files changed

+33
-24
lines changed

3 files changed

+33
-24
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/gallium
2121
- node

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@
3737
"vfile-location": "^4.0.0"
3838
},
3939
"devDependencies": {
40-
"@types/tape": "^4.0.0",
40+
"@types/node": "^18.0.0",
4141
"c8": "^7.0.0",
4242
"mdast-util-from-markdown": "^1.0.0",
4343
"prettier": "^2.0.0",
4444
"remark-cli": "^11.0.0",
4545
"remark-preset-wooorm": "^9.0.0",
46-
"tape": "^5.0.0",
4746
"type-coverage": "^2.0.0",
4847
"typescript": "^4.0.0",
4948
"xo": "^0.53.0"

test.js

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,67 @@
44
* @typedef {Root['children'][number]|Root} Node
55
*/
66

7-
import assert from 'node:assert'
8-
import test from 'tape'
7+
import assert from 'node:assert/strict'
8+
import test from 'node:test'
99
import {fromMarkdown} from 'mdast-util-from-markdown'
1010
import {VFile} from 'vfile'
1111
import {source} from './index.js'
1212

13-
test('unist-util-source', (t) => {
13+
test('unist-util-source', () => {
1414
let file = new VFile('> + **[Hello](./example)**\n> world.')
1515
/** @type {Node} */
1616
let node = fromMarkdown(String(file))
1717

18-
t.equal(source(node, file), '> + **[Hello](./example)**\n> world.', 'root')
18+
assert.equal(
19+
source(node, file),
20+
'> + **[Hello](./example)**\n> world.',
21+
'root'
22+
)
1923

2024
assert(node.type === 'root')
2125
node = node.children[0]
2226
assert(node.type === 'blockquote')
23-
t.equal(
27+
assert.equal(
2428
source(node, file),
2529
'> + **[Hello](./example)**\n> world.',
2630
'block quote'
2731
)
2832

2933
node = node.children[0]
3034
assert(node.type === 'list')
31-
t.equal(source(node, file), '+ **[Hello](./example)**\n> world.', 'list')
35+
assert.equal(source(node, file), '+ **[Hello](./example)**\n> world.', 'list')
3236

3337
node = node.children[0]
3438
assert(node.type === 'listItem')
35-
t.equal(source(node, file), '+ **[Hello](./example)**\n> world.', 'list item')
39+
assert.equal(
40+
source(node, file),
41+
'+ **[Hello](./example)**\n> world.',
42+
'list item'
43+
)
3644

3745
node = node.children[0]
3846
assert(node.type === 'paragraph')
39-
t.equal(source(node, file), '**[Hello](./example)**\n> world.', 'paragraph')
47+
assert.equal(
48+
source(node, file),
49+
'**[Hello](./example)**\n> world.',
50+
'paragraph'
51+
)
4052

4153
node = node.children[0]
4254
assert(node.type === 'strong')
43-
t.equal(source(node, file), '**[Hello](./example)**', 'strong')
55+
assert.equal(source(node, file), '**[Hello](./example)**', 'strong')
4456

4557
node = node.children[0]
4658
assert(node.type === 'link')
47-
t.equal(source(node, file), '[Hello](./example)', 'link')
59+
assert.equal(source(node, file), '[Hello](./example)', 'link')
4860

4961
node = node.children[0]
5062
assert(node.type === 'text')
51-
t.equal(source(node, file), 'Hello', 'text')
63+
assert.equal(source(node, file), 'Hello', 'text')
5264

53-
t.equal(source(node.position, file), 'Hello', 'position')
65+
assert.equal(source(node.position, file), 'Hello', 'position')
5466

55-
t.equal(
67+
assert.equal(
5668
source(
5769
/** @type {Text} */ ({
5870
type: 'text',
@@ -65,39 +77,37 @@ test('unist-util-source', (t) => {
6577
'out of bounds data'
6678
)
6779

68-
t.equal(
80+
assert.equal(
6981
source(/** @type {Text} */ ({type: 'text', value: 'qwe'}), file),
7082
null,
7183
'generated'
7284
)
7385

74-
t.equal(source(null, file), null, 'missing')
86+
assert.equal(source(null, file), null, 'missing')
7587

7688
file = new VFile('a\r\nb')
7789
node = fromMarkdown(String(file))
7890
assert(node.type === 'root')
7991
node = node.children[0]
8092
assert(node.type === 'paragraph')
8193

82-
t.equal(source(node, file), 'a\r\nb', 'cr + lf')
94+
assert.equal(source(node, file), 'a\r\nb', 'cr + lf')
8395

8496
file = new VFile('a\rb')
8597
node = fromMarkdown(String(file))
8698
assert(node.type === 'root')
8799
node = node.children[0]
88100
assert(node.type === 'paragraph')
89101

90-
t.equal(source(node, file), 'a\rb', 'cr')
102+
assert.equal(source(node, file), 'a\rb', 'cr')
91103

92104
file = new VFile('a\n')
93105
node = fromMarkdown(String(file))
94106

95-
t.equal(source(node, file), 'a\n', 'eof eol')
107+
assert.equal(source(node, file), 'a\n', 'eof eol')
96108

97109
file = new VFile('a\n\rb')
98110
node = fromMarkdown(String(file))
99111

100-
t.equal(source(node, file), 'a\n\rb', 'blank lines')
101-
102-
t.end()
112+
assert.equal(source(node, file), 'a\n\rb', 'blank lines')
103113
})

0 commit comments

Comments
 (0)