Skip to content

Commit 5e35565

Browse files
committed
Use Node test runner
1 parent 0f2a116 commit 5e35565

File tree

3 files changed

+26
-28
lines changed

3 files changed

+26
-28
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"mdast-util-to-string": "^3.0.0"
4040
},
4141
"devDependencies": {
42-
"@types/tape": "^4.0.0",
42+
"@types/node": "^18.0.0",
4343
"c8": "^7.0.0",
4444
"mdast-util-from-markdown": "^1.0.0",
4545
"mdast-util-to-markdown": "^1.0.0",
@@ -72,7 +72,7 @@
7272
},
7373
"remarkConfig": {
7474
"plugins": [
75-
"preset-wooorm"
75+
"remark-preset-wooorm"
7676
]
7777
},
7878
"typeCoverage": {

test.js

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@
55
*/
66

77
import assert from 'node:assert/strict'
8-
import test from 'tape'
8+
import test from 'node:test'
99
import {fromMarkdown} from 'mdast-util-from-markdown'
1010
import {toMarkdown} from 'mdast-util-to-markdown'
1111
import {headingRange} from './index.js'
1212

13-
test('mdast-util-heading-range()', (t) => {
14-
t.plan(21)
13+
test('mdast-util-heading-range()', () => {
14+
assert.equal(typeof headingRange, 'function', 'should be a function')
1515

16-
t.equal(typeof headingRange, 'function', 'should be a function')
17-
18-
t.throws(
16+
assert.throws(
1917
() => {
2018
headingRange(
2119
/** @type {Root} */ ({type: 'root', children: []}),
@@ -28,7 +26,7 @@ test('mdast-util-heading-range()', (t) => {
2826
'should throw when `null` is passed in'
2927
)
3028

31-
t.throws(
29+
assert.throws(
3230
() => {
3331
headingRange(
3432
/** @type {Root} */ ({type: 'root', children: []}),
@@ -41,11 +39,11 @@ test('mdast-util-heading-range()', (t) => {
4139
'should throw when `undefined` is passed in'
4240
)
4341

44-
t.doesNotThrow(() => {
42+
assert.doesNotThrow(() => {
4543
headingRange(/** @type {Root} */ ({type: 'root'}), 'x', () => {})
4644
}, 'should not throw when a non-parent is passed')
4745

48-
t.equal(
46+
assert.equal(
4947
checkAndRemove(
5048
['# Fo', '', '## Fooooo', '', 'Bar', '', '# Fo', ''].join('\n'),
5149
'foo+'
@@ -54,7 +52,7 @@ test('mdast-util-heading-range()', (t) => {
5452
'should accept a heading as string'
5553
)
5654

57-
t.equal(
55+
assert.equal(
5856
checkAndRemove(
5957
['# Fo', '', '## Fooooo', '', 'Bar', '', '# Fo', ''].join('\n'),
6058
/foo+/i
@@ -63,7 +61,7 @@ test('mdast-util-heading-range()', (t) => {
6361
'should accept a heading as a regex'
6462
)
6563

66-
t.equal(
64+
assert.equal(
6765
checkAndRemove(
6866
['# Fo', '', '## Fooooo', '', 'Bar', '', '# Fo', ''].join('\n'),
6967
(value) => value.toLowerCase().indexOf('foo') === 0
@@ -72,13 +70,13 @@ test('mdast-util-heading-range()', (t) => {
7270
'should accept a heading as a function'
7371
)
7472

75-
t.equal(
73+
assert.equal(
7674
checkAndRemove(['# Fo', '', '## Fooooo', '', 'Bar', ''].join('\n'), 'foo+'),
7775
['# Fo', '', '## Fooooo', ''].join('\n'),
7876
'should accept a missing closing heading'
7977
)
8078

81-
t.equal(
79+
assert.equal(
8280
checkAndRemove(
8381
['# Fo', '', '## ![Foo](bar.png)', '', 'Bar', '', '# Fo', ''].join('\n'),
8482
'foo+'
@@ -87,7 +85,7 @@ test('mdast-util-heading-range()', (t) => {
8785
'should accept images'
8886
)
8987

90-
t.equal(
88+
assert.equal(
9189
checkAndRemove(
9290
['# Fo', '', '## [Foo](bar.com)', '', 'Bar', '', '# Fo', ''].join('\n'),
9391
'foo+'
@@ -96,7 +94,7 @@ test('mdast-util-heading-range()', (t) => {
9694
'should accept links'
9795
)
9896

99-
t.equal(
97+
assert.equal(
10098
checkAndRemove(
10199
[
102100
'# Fo',
@@ -114,13 +112,13 @@ test('mdast-util-heading-range()', (t) => {
114112
'should accept an image in a link'
115113
)
116114

117-
t.equal(
115+
assert.equal(
118116
checkAndRemove(['# Fo', '', '## Bar', '', 'Baz', ''].join('\n'), 'foo+'),
119117
['# Fo', '', '## Bar', '', 'Baz', ''].join('\n'),
120118
'should not fail without heading'
121119
)
122120

123-
t.equal(
121+
assert.equal(
124122
checkAndRemove(
125123
['# ', '', '## Foo', '', 'Bar', '', '## Baz', ''].join('\n'),
126124
'fo+'
@@ -131,7 +129,7 @@ test('mdast-util-heading-range()', (t) => {
131129

132130
const treeNull = fromMarkdown(['Foo', '', '## Foo', '', 'Bar', ''].join('\n'))
133131
headingRange(treeNull, 'foo', () => null)
134-
t.equal(
132+
assert.equal(
135133
toMarkdown(treeNull),
136134
['Foo', '', '## Foo', '', 'Bar', ''].join('\n'),
137135
'should not remove anything when `null` is given'
@@ -141,7 +139,7 @@ test('mdast-util-heading-range()', (t) => {
141139
['Foo', '', '## Foo', '', 'Bar', ''].join('\n')
142140
)
143141
headingRange(treeEmpty, 'foo', () => [])
144-
t.equal(
142+
assert.equal(
145143
toMarkdown(treeEmpty),
146144
['Foo', ''].join('\n'),
147145
'should replace all previous nodes otherwise'
@@ -155,7 +153,7 @@ test('mdast-util-heading-range()', (t) => {
155153
{type: 'thematicBreak'},
156154
end
157155
])
158-
t.equal(
156+
assert.equal(
159157
toMarkdown(treeFilled),
160158
['Foo', '', '## Foo', '', '***', '', '## Baz', ''].join('\n'),
161159
'should insert all returned nodes'
@@ -165,16 +163,16 @@ test('mdast-util-heading-range()', (t) => {
165163
['# Alpha', '', '## Foo', '', 'one', '', 'two', '', 'three', ''].join('\n')
166164
)
167165
headingRange(treeEmptyEnd, 'foo', (start, nodes, end) => {
168-
t.equal(nodes.length, 3)
166+
assert.equal(nodes.length, 3)
169167
return [start, ...nodes, end]
170168
})
171-
t.equal(
169+
assert.equal(
172170
toMarkdown(treeEmptyEnd),
173171
['# Alpha', '', '## Foo', '', 'one', '', 'two', '', 'three', ''].join('\n'),
174172
'should not insert an empty `end`'
175173
)
176174

177-
t.equal(
175+
assert.equal(
178176
checkAndRemove(
179177
[
180178
'# Fo',
@@ -207,7 +205,7 @@ test('mdast-util-heading-range()', (t) => {
207205
'ignoreFinalDefinitions: should exclude definitions with an end heading'
208206
)
209207

210-
t.equal(
208+
assert.equal(
211209
checkAndRemove(
212210
[
213211
'# Fo',
@@ -238,7 +236,7 @@ test('mdast-util-heading-range()', (t) => {
238236
'ignoreFinalDefinitions: should exclude only definitions'
239237
)
240238

241-
t.equal(
239+
assert.equal(
242240
checkAndRemove(
243241
[
244242
'# Fo',

0 commit comments

Comments
 (0)