mirror of
https://github.com/theoludwig/html-w3c-validator.git
synced 2024-12-08 00:45:37 +01:00
refactor: usage of node:test instead of tap
This commit is contained in:
parent
3d24ffe971
commit
67806866ee
9
.taprc
9
.taprc
@ -1,9 +0,0 @@
|
|||||||
ts: false
|
|
||||||
jsx: false
|
|
||||||
flow: false
|
|
||||||
check-coverage: false
|
|
||||||
coverage: false
|
|
||||||
timeout: 120000
|
|
||||||
|
|
||||||
files:
|
|
||||||
- 'build/**/*.test.js'
|
|
@ -1,21 +1,23 @@
|
|||||||
import tap from 'tap'
|
import test from 'node:test'
|
||||||
|
import assert from 'node:assert/strict'
|
||||||
|
|
||||||
import { execa } from 'execa'
|
import { execa } from 'execa'
|
||||||
|
|
||||||
import { cli } from '../cli.js'
|
import { cli } from '../cli.js'
|
||||||
import { HTMLValidatorCommand } from '../HTMLValidatorCommand.js'
|
import { HTMLValidatorCommand } from '../HTMLValidatorCommand.js'
|
||||||
|
|
||||||
await tap.test('html-w3c-validator', async (t) => {
|
await test('html-w3c-validator', async (t) => {
|
||||||
await t.test('should be instance of the command', async (t) => {
|
await t.test('should be instance of the command', async () => {
|
||||||
const command = cli.process([])
|
const command = cli.process([])
|
||||||
t.equal(command instanceof HTMLValidatorCommand, true)
|
assert(command instanceof HTMLValidatorCommand)
|
||||||
})
|
})
|
||||||
|
|
||||||
await t.test('succeeds and validate the html correctly', async (t) => {
|
await t.test('succeeds and validate the html correctly', async () => {
|
||||||
const exampleURL = new URL('../../example', import.meta.url)
|
const exampleURL = new URL('../../example', import.meta.url)
|
||||||
process.chdir(exampleURL.pathname)
|
process.chdir(exampleURL.pathname)
|
||||||
await execa('rimraf', ['node_modules'])
|
await execa('rimraf', ['node_modules'])
|
||||||
await execa('npm', ['install'])
|
await execa('npm', ['install'])
|
||||||
const { exitCode } = await execa('npm', ['run', 'test:html-w3c-validator'])
|
const { exitCode } = await execa('npm', ['run', 'test:html-w3c-validator'])
|
||||||
t.equal(exitCode, 0)
|
assert.strictEqual(exitCode, 0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
|
import test from 'node:test'
|
||||||
|
import assert from 'node:assert/strict'
|
||||||
|
|
||||||
import fsMock from 'mock-fs'
|
import fsMock from 'mock-fs'
|
||||||
import tap from 'tap'
|
|
||||||
|
|
||||||
import { isExistingPath } from '../isExistingPath.js'
|
import { isExistingPath } from '../isExistingPath.js'
|
||||||
|
|
||||||
await tap.test('utils/isExistingPath', async (t) => {
|
await test('utils/isExistingPath', async (t) => {
|
||||||
t.afterEach(() => {
|
t.afterEach(() => {
|
||||||
fsMock.restore()
|
fsMock.restore()
|
||||||
})
|
})
|
||||||
@ -12,13 +14,13 @@ await tap.test('utils/isExistingPath', async (t) => {
|
|||||||
fsMock({
|
fsMock({
|
||||||
'/file.txt': ''
|
'/file.txt': ''
|
||||||
})
|
})
|
||||||
t.equal(await isExistingPath('/file.txt'), true)
|
assert.strictEqual(await isExistingPath('/file.txt'), true)
|
||||||
})
|
})
|
||||||
|
|
||||||
await t.test("should return false if the file doesn't exists", async () => {
|
await t.test("should return false if the file doesn't exists", async () => {
|
||||||
fsMock({
|
fsMock({
|
||||||
'/file.txt': ''
|
'/file.txt': ''
|
||||||
})
|
})
|
||||||
t.equal(await isExistingPath('/randomfile.txt'), false)
|
assert.strictEqual(await isExistingPath('/randomfile.txt'), false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user