Skip to content

Commit

Permalink
Use Node test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Feb 3, 2023
1 parent a3a5f39 commit 260a782
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ jobs:
strategy:
matrix:
node:
- lts/fermium
- lts/gallium
- node
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@
"mdast-util-to-markdown": "^1.0.0"
},
"devDependencies": {
"@types/tape": "^4.0.0",
"@types/node": "^18.0.0",
"c8": "^7.0.0",
"micromark-extension-mdx": "^1.0.0",
"micromark-extension-mdxjs": "^1.0.0",
"prettier": "^2.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"tape": "^5.0.0",
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"xo": "^0.53.0"
Expand Down
29 changes: 13 additions & 16 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import test from 'tape'
import assert from 'node:assert/strict'
import test from 'node:test'
import {fromMarkdown} from 'mdast-util-from-markdown'
import {toMarkdown} from 'mdast-util-to-markdown'
import {mdxjs} from 'micromark-extension-mdxjs'
import {mdxFromMarkdown, mdxToMarkdown} from './index.js'

test('markdown -> mdast', (t) => {
t.deepEqual(
test('mdxFromMarkdown', () => {
assert.deepEqual(
JSON.parse(
JSON.stringify(
fromMarkdown('import a from "b"', {
Expand Down Expand Up @@ -95,7 +96,7 @@ test('markdown -> mdast', (t) => {
'should support esm'
)

t.deepEqual(
assert.deepEqual(
fromMarkdown('<x/>', {
extensions: [mdxjs()],
mdastExtensions: [mdxFromMarkdown()]
Expand All @@ -122,7 +123,7 @@ test('markdown -> mdast', (t) => {
'should support jsx'
)

t.deepEqual(
assert.deepEqual(
JSON.parse(
JSON.stringify(
fromMarkdown('{1 + 1}', {
Expand Down Expand Up @@ -212,7 +213,7 @@ test('markdown -> mdast', (t) => {
'should support expressions'
)

t.deepEqual(
assert.deepEqual(
JSON.parse(
JSON.stringify(
fromMarkdown(
Expand Down Expand Up @@ -342,7 +343,7 @@ test('markdown -> mdast', (t) => {
'should add proper positions on estree (1)'
)

t.deepEqual(
assert.deepEqual(
JSON.parse(
JSON.stringify(
fromMarkdown("export let a = 'a'\n\nexport let b = 'b'", {
Expand Down Expand Up @@ -526,12 +527,10 @@ test('markdown -> mdast', (t) => {
},
'should add proper positions on estree (2)'
)

t.end()
})

test('mdast -> markdown', (t) => {
t.equal(
test('mdxToMarkdown', () => {
assert.equal(
toMarkdown(
{type: 'mdxjsEsm', value: 'import a from "b"'},
{extensions: [mdxToMarkdown()]}
Expand All @@ -540,7 +539,7 @@ test('mdast -> markdown', (t) => {
'should support esm'
)

t.equal(
assert.equal(
toMarkdown(
{type: 'mdxJsxFlowElement', name: 'x', attributes: [], children: []},
{extensions: [mdxToMarkdown()]}
Expand All @@ -549,7 +548,7 @@ test('mdast -> markdown', (t) => {
'should support jsx'
)

t.deepEqual(
assert.deepEqual(
toMarkdown(
{type: 'mdxFlowExpression', value: '1 + 1'},
{extensions: [mdxToMarkdown()]}
Expand All @@ -558,7 +557,7 @@ test('mdast -> markdown', (t) => {
'should support expressions'
)

t.deepEqual(
assert.deepEqual(
toMarkdown(
{
type: 'link',
Expand All @@ -570,6 +569,4 @@ test('mdast -> markdown', (t) => {
'[tel:123](tel:123)\n',
'should use link (resource) instead of link (auto)'
)

t.end()
})

0 comments on commit 260a782

Please sign in to comment.