|
2 | 2 | * @typedef {import('../index.js').Plugin} Plugin
|
3 | 3 | */
|
4 | 4 |
|
| 5 | +import assert from 'node:assert/strict' |
5 | 6 | import fs from 'node:fs/promises'
|
6 |
| -import test from 'tape' |
| 7 | +import test from 'node:test' |
7 | 8 | import jsx from 'acorn-jsx'
|
8 | 9 | // @ts-expect-error: untyped.
|
9 | 10 | import stage3 from 'acorn-stage3'
|
10 | 11 | import {fromJs} from '../index.js'
|
11 | 12 |
|
12 |
| -test('estree-util-from-js', (t) => { |
13 |
| - t.deepEqual( |
| 13 | +test('estree-util-from-js', () => { |
| 14 | + assert.deepEqual( |
14 | 15 | fromJs('1 + "2"'),
|
15 | 16 | {
|
16 | 17 | type: 'Program',
|
@@ -57,15 +58,15 @@ test('estree-util-from-js', (t) => {
|
57 | 58 | 'should work'
|
58 | 59 | )
|
59 | 60 |
|
60 |
| - t.throws( |
| 61 | + assert.throws( |
61 | 62 | function () {
|
62 | 63 | fromJs('import "a"')
|
63 | 64 | },
|
64 | 65 | /'import' and 'export' may appear only with 'sourceType: module'/,
|
65 | 66 | 'should fail on an import w/o `module: true`'
|
66 | 67 | )
|
67 | 68 |
|
68 |
| - t.deepEqual( |
| 69 | + assert.deepEqual( |
69 | 70 | fromJs('import "a"', {module: true}),
|
70 | 71 | {
|
71 | 72 | type: 'Program',
|
@@ -97,7 +98,7 @@ test('estree-util-from-js', (t) => {
|
97 | 98 | 'should support an import w/ `module: true`'
|
98 | 99 | )
|
99 | 100 |
|
100 |
| - t.deepEqual( |
| 101 | + assert.deepEqual( |
101 | 102 | fromJs('<x />', {plugins: [jsx()]}),
|
102 | 103 | {
|
103 | 104 | type: 'Program',
|
@@ -146,7 +147,7 @@ test('estree-util-from-js', (t) => {
|
146 | 147 | 'should support a plugin'
|
147 | 148 | )
|
148 | 149 |
|
149 |
| - t.deepEqual( |
| 150 | + assert.deepEqual( |
150 | 151 | fromJs('#!/bin/sh\n1', {allowHashBang: true}),
|
151 | 152 | {
|
152 | 153 | type: 'Program',
|
@@ -185,17 +186,13 @@ test('estree-util-from-js', (t) => {
|
185 | 186 | },
|
186 | 187 | 'should support `options.allowHashBang`'
|
187 | 188 | )
|
188 |
| - |
189 |
| - t.end() |
190 | 189 | })
|
191 | 190 |
|
192 |
| -test('fixtures', async function (t) { |
| 191 | +test('fixtures', async function () { |
193 | 192 | const base = new URL('fixtures/', import.meta.url)
|
194 | 193 | const filenames = await fs.readdir(base)
|
195 | 194 | const tests = filenames.filter((d) => d.charAt(0) !== '.')
|
196 | 195 |
|
197 |
| - t.plan(tests.length) |
198 |
| - |
199 | 196 | let index = -1
|
200 | 197 | while (++index < tests.length) {
|
201 | 198 | const filename = tests[index]
|
@@ -227,8 +224,6 @@ test('fixtures', async function (t) {
|
227 | 224 | await fs.writeFile(treeUrl, expected)
|
228 | 225 | }
|
229 | 226 |
|
230 |
| - t.deepEqual(actual, expected, filename) |
| 227 | + assert.deepEqual(actual, expected, filename) |
231 | 228 | }
|
232 |
| - |
233 |
| - t.end() |
234 | 229 | })
|
0 commit comments