Skip to content

Commit 8db84a7

Browse files
committed
Replace tape w/ node:test
1 parent 380cff0 commit 8db84a7

File tree

2 files changed

+23
-28
lines changed

2 files changed

+23
-28
lines changed

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@
4343
},
4444
"devDependencies": {
4545
"@types/lodash.iteratee": "^4.0.0",
46-
"@types/tape": "^5.0.0",
46+
"@types/node": "^20.0.0",
4747
"c8": "^8.0.0",
4848
"mdast-util-from-markdown": "^2.0.0",
4949
"prettier": "^3.0.0",
5050
"remark-cli": "^11.0.0",
5151
"remark-preset-wooorm": "^9.0.0",
52-
"tape": "^5.0.0",
5352
"type-coverage": "^2.0.0",
5453
"typescript": "^5.0.0",
5554
"xo": "^0.55.0"

test.js

+22-26
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,51 @@
11
import assert from 'node:assert/strict'
2-
import test from 'tape'
2+
import test from 'node:test'
33
import {fromMarkdown} from 'mdast-util-from-markdown'
44
import {find} from 'unist-util-find'
55

6-
test('find', function (t) {
6+
test('find', async function (t) {
77
const tree = fromMarkdown('Some _emphasis_, **strongness**, and `code`.')
88
assert(tree.type === 'root')
99
const paragraph = tree.children[0]
1010
assert(paragraph.type === 'paragraph')
1111

12-
t.throws(function () {
13-
// @ts-expect-error: check that an error is thrown at runtime.
14-
find()
15-
}, 'should fail without tree')
12+
await t.test('should fail without tree', function () {
13+
assert.throws(function () {
14+
// @ts-expect-error: check that an error is thrown at runtime.
15+
find()
16+
})
17+
})
1618

17-
t.throws(function () {
18-
// @ts-expect-error: check that an error is thrown at runtime.
19-
find(tree)
20-
}, 'should fail without condition')
19+
await t.test('should fail without condition', function () {
20+
assert.throws(function () {
21+
// @ts-expect-error: check that an error is thrown at runtime.
22+
find(tree)
23+
})
24+
})
2125

22-
t.test('should find with string condition', function (st) {
26+
await t.test('should find with string condition', function () {
2327
const result = find(tree, 'value')
2428

25-
st.equal(result, paragraph.children[0])
26-
27-
st.end()
29+
assert.equal(result, paragraph.children[0])
2830
})
2931

30-
t.test('should find with object condition', function (st) {
32+
await t.test('should find with object condition', function () {
3133
const result = find(tree, {type: 'emphasis'})
3234

33-
st.equal(result, paragraph.children[1])
34-
35-
st.end()
35+
assert.equal(result, paragraph.children[1])
3636
})
3737

38-
t.test('should find with function condition', function (st) {
38+
await t.test('should find with function condition', function () {
3939
const result = find(tree, function (node) {
4040
return node.type === 'inlineCode'
4141
})
4242

43-
st.equal(result, paragraph.children[5])
44-
45-
st.end()
43+
assert.equal(result, paragraph.children[5])
4644
})
4745

48-
t.test('should return undefined if no matches', function (st) {
46+
await t.test('should return undefined if no matches', function () {
4947
const result = find(tree, 'nope, nope, nope')
5048

51-
st.equal(result, undefined)
52-
53-
st.end()
49+
assert.equal(result, undefined)
5450
})
5551
})

0 commit comments

Comments
 (0)