Skip to content

Commit 5ab03c4

Browse files
committed
Use Node test runner
1 parent b81001f commit 5ab03c4

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
"react": ">=16"
101101
},
102102
"devDependencies": {
103+
"@types/node": "^18.0.0",
103104
"@types/react": "^18.0.0",
104105
"@types/react-dom": "^18.0.0",
105106
"@types/react-is": "^17.0.0",
@@ -121,14 +122,13 @@
121122
"rimraf": "^3.0.0",
122123
"type-coverage": "^2.0.0",
123124
"typescript": "^4.0.0",
124-
"uvu": "^0.5.0",
125125
"xo": "^0.53.0"
126126
},
127127
"scripts": {
128128
"prepack": "npm run build && npm run format",
129129
"build": "tsc --build --clean && tsc --build && type-coverage && esbuild index.js --bundle --minify --target=es2015 --outfile=react-markdown.min.js --global-name=ReactMarkdown --banner:js=\"(function (g, f) {typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = f() : typeof define === 'function' && define.amd ? define([], f) : (g = typeof globalThis !== 'undefined' ? globalThis : g || self, g.ReactMarkdown = f()); }(this, (function () { 'use strict';\" --footer:js=\"return ReactMarkdown;})));\"",
130130
"format": "remark . -qfo --ignore-pattern test/ && prettier . -w --loglevel warn && xo --fix",
131-
"test-api": "node --no-warnings --experimental-loader=./test/loader.js --conditions development ./node_modules/.bin/uvu test \"\\.jsx$\"",
131+
"test-api": "node --no-warnings --experimental-loader=./test/loader.js --conditions development test/test.jsx",
132132
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
133133
"test": "npm run build && npm run format && npm run test-coverage"
134134
},

test/test.jsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* @typedef {import('react').ReactNode} ReactNode
55
*/
66

7+
import assert from 'node:assert/strict'
78
import fs from 'node:fs/promises'
8-
import {test} from 'uvu'
9-
import * as assert from 'uvu/assert'
9+
import test from 'node:test'
1010
import React from 'react'
1111
import gfm from 'remark-gfm'
1212
import {visit} from 'unist-util-visit'
@@ -728,7 +728,7 @@ test('should pass on raw source position to non-tag components if rawSourcePos o
728728
rawSourcePos
729729
components={{
730730
em({node, sourcePosition, ...props}) {
731-
assert.equal(sourcePosition, {
731+
assert.deepEqual(sourcePosition, {
732732
start: {line: 1, column: 1, offset: 0},
733733
end: {line: 1, column: 6, offset: 5}
734734
})
@@ -754,7 +754,7 @@ test('should pass on raw source position to non-tag components if rawSourcePos o
754754
components={{
755755
// @ts-expect-error JSX types currently only handle element returns not string returns
756756
em({sourcePosition}) {
757-
assert.equal(sourcePosition, {
757+
assert.deepEqual(sourcePosition, {
758758
start: {line: 1, column: 1, offset: 0},
759759
end: {line: 1, column: 6, offset: 5}
760760
})
@@ -1436,7 +1436,7 @@ test('should support remark plugins with array parameter', async () => {
14361436
const expected = '<p>a</p>'
14371437
assert.equal(actual, expected)
14381438

1439-
assert.not.match(message, /Warning: Failed/, 'Prop types should be valid')
1439+
assert.doesNotMatch(message, /Warning: Failed/, 'Prop types should be valid')
14401440
console.error = error
14411441
})
14421442

@@ -1459,8 +1459,6 @@ test('should support rehype plugins with array parameter', async () => {
14591459
const expected = '<p>a</p>'
14601460
assert.equal(actual, expected)
14611461

1462-
assert.not.match(message, /Warning: Failed/, 'Prop types should be valid')
1462+
assert.doesNotMatch(message, /Warning: Failed/, 'Prop types should be valid')
14631463
console.error = error
14641464
})
1465-
1466-
test.run()

0 commit comments

Comments
 (0)