More isolated webhint tests

master
Kuba Orlik 11 months ago
parent f7538a362d
commit 531a0e5cc2

30771
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -16,7 +16,7 @@
"test-cmd-once": "vitest run --config ./src/back/vitest.config.ts", "test-cmd-once": "vitest run --config ./src/back/vitest.config.ts",
"test": "npm run test-cmd -- --ui", "test": "npm run test-cmd -- --ui",
"coverage": "npm run test --coverage", "coverage": "npm run test --coverage",
"postinstall": "sealgen make-env", "postinstall": "sealgen make-env && npm install --prefix webhint",
"test-reports": "npm run test-cmd-once -- --coverage", "test-reports": "npm run test-cmd-once -- --coverage",
"show-coverage": "npm run test-reports; xdg-open coverage/index.html" "show-coverage": "npm run test-reports; xdg-open coverage/index.html"
}, },
@ -35,11 +35,10 @@
"@hotwired/turbo": "^7.1.0", "@hotwired/turbo": "^7.1.0",
"@koa/router": "^12.0.1", "@koa/router": "^12.0.1",
"@playwright/test": "^1.36.1", "@playwright/test": "^1.36.1",
"@sealcode/sealgen": "^0.9.0", "@sealcode/sealgen": "^0.10.1",
"@sealcode/ts-predicates": "^0.4.3", "@sealcode/ts-predicates": "^0.4.3",
"@types/kill-port": "^2.0.0", "@types/kill-port": "^2.0.0",
"get-port": "^7.0.0", "get-port": "^7.0.0",
"hint": "^7.0.1",
"locreq": "^3.0.0", "locreq": "^3.0.0",
"multiple-scripts-tmux": "^1.0.4", "multiple-scripts-tmux": "^1.0.4",
"nodemon": "^3.0.1", "nodemon": "^3.0.1",
@ -49,10 +48,6 @@
"vitest": "^1.1.0" "vitest": "^1.1.0"
}, },
"devDependencies": { "devDependencies": {
"@hint/connector-jsdom": "^4.1.20",
"@hint/formatter-codeframe": "^3.1.29",
"@hint/hint-doctype": "^3.3.19",
"@hint/hint-no-broken-links": "^4.2.19",
"@sealcode/ansi-html-stream": "^1.0.1", "@sealcode/ansi-html-stream": "^1.0.1",
"@types/koa__router": "^12.0.4", "@types/koa__router": "^12.0.4",
"@types/node": "^20.8.4", "@types/node": "^20.8.4",

@ -11,14 +11,14 @@ export async function webhintURL(url: string, config = locreq.resolve(".hintrc")
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log("scanning with webhint....", url); console.log("scanning with webhint....", url);
try { try {
console.log("cwd", locreq.resolve("webhint"));
const subprocess = spawn( const subprocess = spawn(
"node", "node",
[locreq.resolve("node_modules/.bin/hint"), "--config", config, url], [locreq.resolve("webhint/node_modules/.bin/hint"), "--config", config, url],
{ { cwd: locreq.resolve("webhint") } // to prevent webhint from trying to parese source code
stdio: "inherit",
shell: true,
}
); );
subprocess.stderr.on("data", (b) => console.error(b.toString()));
subprocess.stdout.on("data", (b) => console.log(b.toString()));
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
subprocess.on("close", (code) => subprocess.on("close", (code) =>
code === 0 ? resolve() : reject(new Error("Webhint tests failed")) code === 0 ? resolve() : reject(new Error("Webhint tests failed"))

@ -1,13 +1,15 @@
import { defineConfig } from "vitest/config"; import { defineConfig } from "vitest/config";
const exclude = ["docker_node_modules", "node_modules", "dist", "lib", "webhint"];
export default defineConfig({ export default defineConfig({
test: { test: {
testTimeout: 10000, testTimeout: 10000,
setupFiles: ["src/back/test-teardown.ts"], setupFiles: ["src/back/test-teardown.ts"],
exclude: ["docker_node_modules", "node_modules", "dist", "lib"], exclude,
globals: true, globals: true,
coverage: { coverage: {
exclude: ["docker_node_modules", "node_modules", "dist", "lib"], exclude,
enabled: true, enabled: true,
all: true, all: true,
include: ["src/**", "test?(-*).?(c|m)[jt]s?(x)"], include: ["src/**", "test?(-*).?(c|m)[jt]s?(x)"],

@ -0,0 +1 @@
// this file is just a placeholder to have a clean webhint working directory

File diff suppressed because it is too large Load Diff

@ -0,0 +1,18 @@
{
"name": "webhint",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@hint/formatter-codeframe": "^3.1.35",
"@hint/hint-doctype": "^3.3.26",
"@hint/hint-no-broken-links": "^4.2.26",
"hint": "^7.1.10"
}
}
Loading…
Cancel
Save