Skip to content

Commit 67cf76f

Browse files
committed
Use Node test runner
1 parent f635c36 commit 67cf76f

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-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
@@ -42,13 +42,12 @@
4242
"vfile-message": "^3.0.0"
4343
},
4444
"devDependencies": {
45-
"@types/tape": "^4.0.0",
45+
"@types/node": "^18.0.0",
4646
"acorn-stage3": "^4.0.0",
4747
"c8": "^7.0.0",
4848
"prettier": "^2.0.0",
4949
"remark-cli": "^11.0.0",
5050
"remark-preset-wooorm": "^9.0.0",
51-
"tape": "^5.0.0",
5251
"type-coverage": "^2.0.0",
5352
"typescript": "^4.0.0",
5453
"xo": "^0.53.0"

test/index.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
* @typedef {import('../index.js').Plugin} Plugin
33
*/
44

5+
import assert from 'node:assert/strict'
56
import fs from 'node:fs/promises'
6-
import test from 'tape'
7+
import test from 'node:test'
78
import jsx from 'acorn-jsx'
89
// @ts-expect-error: untyped.
910
import stage3 from 'acorn-stage3'
1011
import {fromJs} from '../index.js'
1112

12-
test('estree-util-from-js', (t) => {
13-
t.deepEqual(
13+
test('estree-util-from-js', () => {
14+
assert.deepEqual(
1415
fromJs('1 + "2"'),
1516
{
1617
type: 'Program',
@@ -57,15 +58,15 @@ test('estree-util-from-js', (t) => {
5758
'should work'
5859
)
5960

60-
t.throws(
61+
assert.throws(
6162
function () {
6263
fromJs('import "a"')
6364
},
6465
/'import' and 'export' may appear only with 'sourceType: module'/,
6566
'should fail on an import w/o `module: true`'
6667
)
6768

68-
t.deepEqual(
69+
assert.deepEqual(
6970
fromJs('import "a"', {module: true}),
7071
{
7172
type: 'Program',
@@ -97,7 +98,7 @@ test('estree-util-from-js', (t) => {
9798
'should support an import w/ `module: true`'
9899
)
99100

100-
t.deepEqual(
101+
assert.deepEqual(
101102
fromJs('<x />', {plugins: [jsx()]}),
102103
{
103104
type: 'Program',
@@ -146,7 +147,7 @@ test('estree-util-from-js', (t) => {
146147
'should support a plugin'
147148
)
148149

149-
t.deepEqual(
150+
assert.deepEqual(
150151
fromJs('#!/bin/sh\n1', {allowHashBang: true}),
151152
{
152153
type: 'Program',
@@ -185,17 +186,13 @@ test('estree-util-from-js', (t) => {
185186
},
186187
'should support `options.allowHashBang`'
187188
)
188-
189-
t.end()
190189
})
191190

192-
test('fixtures', async function (t) {
191+
test('fixtures', async function () {
193192
const base = new URL('fixtures/', import.meta.url)
194193
const filenames = await fs.readdir(base)
195194
const tests = filenames.filter((d) => d.charAt(0) !== '.')
196195

197-
t.plan(tests.length)
198-
199196
let index = -1
200197
while (++index < tests.length) {
201198
const filename = tests[index]
@@ -227,8 +224,6 @@ test('fixtures', async function (t) {
227224
await fs.writeFile(treeUrl, expected)
228225
}
229226

230-
t.deepEqual(actual, expected, filename)
227+
assert.deepEqual(actual, expected, filename)
231228
}
232-
233-
t.end()
234229
})

0 commit comments

Comments
 (0)