From ab7eb0b12fcada270b8b8fa2b4e756e174e3a245 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 25 Jan 2023 11:03:40 +0100 Subject: [PATCH] Use Node test runner --- .github/workflows/main.yml | 2 +- package.json | 2 +- test.js | 31 +++++++++++++++++-------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89dc06c..fb63387 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,5 +17,5 @@ jobs: strategy: matrix: node: - - lts/fermium + - lts/gallium - node diff --git a/package.json b/package.json index 2f46508..a8a8ea1 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@types/mdast": "^3.0.0" }, "devDependencies": { - "@types/tape": "^4.0.0", + "@types/node": "^18.0.0", "c8": "^7.0.0", "prettier": "^2.0.0", "remark-cli": "^11.0.0", diff --git a/test.js b/test.js index 7a1d0ec..c7ec9e4 100644 --- a/test.js +++ b/test.js @@ -1,14 +1,19 @@ -import test from 'tape' +import assert from 'node:assert/strict' +import test from 'node:test' import {toString} from './index.js' -test('toString', (t) => { +test('toString', () => { // @ts-expect-error: runtime. - t.equal(toString(), '', 'should not fail on a missing node') - t.equal(toString(null), '', 'should not fail on `null` missing node') + assert.equal(toString(), '', 'should not fail on a missing node') + assert.equal(toString(null), '', 'should not fail on `null` missing node') - t.equal(toString({value: 'foo'}), 'foo', 'should not fail on nodes w/o type') + assert.equal( + toString({value: 'foo'}), + 'foo', + 'should not fail on nodes w/o type' + ) - t.equal( + assert.equal( toString({ value: 'foo', alt: 'bar', @@ -19,37 +24,35 @@ test('toString', (t) => { 'should prefer `value` over all others' ) - t.equal( + assert.equal( toString({alt: 'bar', title: 'baz', children: [{value: 'qux'}]}), 'bar', 'should prefer `alt` over all others' ) - t.equal( + assert.equal( toString({title: 'baz', children: [{value: 'qux'}]}), 'qux', 'should *not* prefer `title` over all others' ) - t.equal( + assert.equal( toString({alt: 'bar'}, {includeImageAlt: false}), '', 'should *not* include `alt` w/ `includeImageAlt: false`' ) - t.equal( + assert.equal( toString({children: [{value: 'foo'}, {alt: 'bar'}, {title: 'baz'}]}), 'foobar', 'should serialize children' ) - t.equal( + assert.equal( toString([{value: 'foo'}, {alt: 'bar'}, {title: 'baz'}]), 'foobar', 'should serialize a list of nodes' ) - t.equal(toString({}), '', 'should produce an empty string otherwise') - - t.end() + assert.equal(toString({}), '', 'should produce an empty string otherwise') })