From 10aab5d851b68ac85f521854953c4cf86a86c682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Belin?= Date: Tue, 22 Oct 2024 19:04:31 +0200 Subject: [PATCH] Code optimization --- etc/puppeteer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/puppeteer.js b/etc/puppeteer.js index 9d561dc..9602425 100644 --- a/etc/puppeteer.js +++ b/etc/puppeteer.js @@ -1,6 +1,7 @@ const console = require("node:console"); const {writeFile} = require("node:fs/promises"); const {createServer} = require("node:http"); +const {join} = require("node:path"); const process = require("node:process"); const puppeteer = require("puppeteer"); const handler = require("serve-handler"); @@ -8,7 +9,7 @@ const handler = require("serve-handler"); // Run the test suite. (async function main() { const browser = await puppeteer.launch(); - const server = createServer((req, res) => handler(req, res, {public: "var"})); + const server = createServer((req, res) => handler(req, res, {public: join(__dirname, "../var")})); const page = await browser.newPage(); page.on("console", message => console.log(message.text())); @@ -21,7 +22,7 @@ const handler = require("serve-handler"); process.exit(code); }); - await writeFile("var/tests.html", ` + await writeFile(join(__dirname, "../var/tests.html"), `