mirror of
https://github.com/theoludwig/markdownlint-rule-relative-links.git
synced 2024-12-08 00:45:32 +01:00
refactor: usage of node:test instead of tap
This commit is contained in:
parent
cbc6042bd5
commit
2d63a30f48
8
.taprc
8
.taprc
@ -1,8 +0,0 @@
|
||||
ts: false
|
||||
jsx: false
|
||||
flow: false
|
||||
check-coverage: false
|
||||
coverage: false
|
||||
|
||||
files:
|
||||
- 'test/**/*.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'
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user