From 2d63a30f48c4e22b43386cabf9615d6b3c6fddfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LUDWIG?= Date: Sat, 24 Jun 2023 09:58:45 +0200 Subject: [PATCH] refactor: usage of node:test instead of tap --- .taprc | 8 -------- test/basic.test.js | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 .taprc diff --git a/.taprc b/.taprc deleted file mode 100644 index bd71b5a..0000000 --- a/.taprc +++ /dev/null @@ -1,8 +0,0 @@ -ts: false -jsx: false -flow: false -check-coverage: false -coverage: false - -files: - - 'test/**/*.test.js' diff --git a/test/basic.test.js b/test/basic.test.js index ed46ff6..efbc167 100644 --- a/test/basic.test.js +++ b/test/basic.test.js @@ -1,9 +1,11 @@ -const tap = require('tap') +const test = require('node:test') +const assert = require('node:assert/strict') + const { markdownlint } = require('markdownlint').promises const relativeLinks = require('../src/index.js') -tap.test('ensure we validate correctly', async (t) => { +test('ensure we validate correctly', async () => { const lintResults = await markdownlint({ files: ['test/fixtures/Valid.md', 'test/fixtures/Invalid.md'], config: { @@ -11,23 +13,23 @@ tap.test('ensure we validate correctly', async (t) => { }, customRules: [relativeLinks] }) - t.equal(lintResults['test/fixtures/Valid.md'].length, 0) - t.equal(lintResults['test/fixtures/Invalid.md'].length, 2) + assert.equal(lintResults['test/fixtures/Valid.md'].length, 0) + assert.equal(lintResults['test/fixtures/Invalid.md'].length, 2) - t.equal( + assert.equal( lintResults['test/fixtures/Invalid.md'][0]?.ruleDescription, 'Relative links should be valid' ) - t.equal( + assert.equal( lintResults['test/fixtures/Invalid.md'][0]?.errorDetail, 'Link "./basic.test.js" is dead' ) - t.equal( + assert.equal( lintResults['test/fixtures/Invalid.md'][1]?.ruleDescription, 'Relative links should be valid' ) - t.equal( + assert.equal( lintResults['test/fixtures/Invalid.md'][1]?.errorDetail, 'Link "../image.png" is dead' )