Skip to content

Commit 90d21f9

Browse files
committed
Use Node test runner
1 parent 4e6a846 commit 90d21f9

File tree

3 files changed

+23
-26
lines changed

3 files changed

+23
-26
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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@
3838
},
3939
"devDependencies": {
4040
"@types/acorn": "^4.0.0",
41-
"@types/tape": "^4.0.0",
41+
"@types/node": "^18.0.0",
4242
"acorn": "^8.0.0",
4343
"c8": "^7.0.0",
4444
"estree-util-visit": "^1.0.0",
4545
"prettier": "^2.0.0",
4646
"recast": "^0.22.0",
4747
"remark-cli": "^11.0.0",
4848
"remark-preset-wooorm": "^9.0.0",
49-
"rimraf": "^3.0.0",
50-
"tape": "^5.0.0",
5149
"type-coverage": "^2.0.0",
5250
"typescript": "^4.0.0",
5351
"xo": "^0.53.0"

test.js

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
1-
import test from 'tape'
2-
import {parse as acornParse} from 'acorn'
3-
import recast from 'recast'
4-
import {visit} from 'estree-util-visit'
5-
import {attachComments} from './index.js'
6-
71
/**
82
* @typedef {import('estree').BaseNode} EstreeNode
93
* @typedef {import('estree').Program} EstreeProgram
104
* @typedef {import('estree').Comment} EstreeComment
115
*/
126

13-
test('estree-attach-comments (recast)', (t) => {
14-
t.equal(
7+
import assert from 'node:assert/strict'
8+
import test from 'node:test'
9+
import {parse as acornParse} from 'acorn'
10+
import recast from 'recast'
11+
import {visit} from 'estree-util-visit'
12+
import {attachComments} from './index.js'
13+
14+
test('estree-attach-comments (recast)', () => {
15+
assert.equal(
1516
recast.print(attachComments(...parse(''))).code,
1617
'',
1718
'should support an empty document'
1819
)
1920

20-
t.equal(
21+
assert.equal(
2122
recast.print(attachComments(...parse('a + 1'))).code,
2223
'a + 1;',
2324
'should support no comments'
2425
)
2526

26-
t.equal(
27+
assert.equal(
2728
recast.print(attachComments(...parse('/* ! */'))).code,
2829
'/* ! */\n',
2930
'should support a single block comment'
3031
)
3132

32-
t.equal(
33+
assert.equal(
3334
recast.print(attachComments(...parse('// !'))).code,
3435
'// !\n',
3536
'should support a single line comment'
3637
)
3738

38-
t.equal(
39+
assert.equal(
3940
recast.print(
4041
attachComments(...parse('/* 1 */ function a (/* 2 */b) { return b + 1 }'))
4142
).code,
4243
'/* 1 */\nfunction a(\n /* 2 */\n b\n) {\n return b + 1;\n}',
4344
'should support some comments'
4445
)
4546

46-
t.equal(
47+
assert.equal(
4748
recast.print(
4849
attachComments(
4950
...parse(
@@ -58,15 +59,15 @@ test('estree-attach-comments (recast)', (t) => {
5859
// Recast parses `4` as “dangling”:
5960
// <https://github.com/benjamn/recast/blob/dd7c5ec/lib/comments.ts#L255-L256>
6061
// But apprently doesn’t serialize it?
61-
t.equal(
62+
assert.equal(
6263
recast.print(
6364
attachComments(...parse('/* 1 */ a /* 2 */ = /* 3 */ { /* 4 */ }'))
6465
).code,
6566
'/* 1 */\na = /* 2 */\n/* 3 */\n{};',
6667
'should support some more comments'
6768
)
6869

69-
t.equal(
70+
assert.equal(
7071
recast.print(
7172
attachComments(
7273
...parse(
@@ -90,7 +91,7 @@ test('estree-attach-comments (recast)', (t) => {
9091

9192
removePositions(tree)
9293

93-
t.equal(
94+
assert.equal(
9495
recast.print(attachComments(tree, comments)).code,
9596
'a + 1;',
9697
'should not fail on a tree w/o positional info'
@@ -104,7 +105,7 @@ test('estree-attach-comments (recast)', (t) => {
104105
onComment: comments
105106
})
106107

107-
t.equal(
108+
assert.equal(
108109
recast.print(attachComments(tree)).code,
109110
'1 + 1;',
110111
'should not fail w/o comments'
@@ -121,7 +122,7 @@ test('estree-attach-comments (recast)', (t) => {
121122

122123
removePositions(comments)
123124

124-
t.equal(
125+
assert.equal(
125126
recast.print(attachComments(tree, comments)).code,
126127
'a + 1;',
127128
'should not fail on comments w/o positional info'
@@ -138,7 +139,7 @@ test('estree-attach-comments (recast)', (t) => {
138139

139140
removePositions(tree)
140141

141-
t.equal(
142+
assert.equal(
142143
recast.print(attachComments(tree, comments)).code,
143144
'/* 1 */\na + /* 2 */\n/* 3 */\n1;',
144145
'should use `range`s'
@@ -155,13 +156,11 @@ test('estree-attach-comments (recast)', (t) => {
155156

156157
removePositions(tree)
157158

158-
t.equal(
159+
assert.equal(
159160
recast.print(attachComments(tree, comments)).code,
160161
'/* 1 */\na + /* 2 */\n/* 3 */\n1;',
161162
'should use `loc`s'
162163
)
163-
164-
t.end()
165164
})
166165

167166
/**

0 commit comments

Comments
 (0)