Skip to content

Commit

Permalink
Code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Oct 22, 2024
1 parent 40e0a21 commit 10aab5d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions etc/puppeteer.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
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");

// 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()));
Expand All @@ -21,7 +22,7 @@ const handler = require("serve-handler");
process.exit(code);
});

await writeFile("var/tests.html", `
await writeFile(join(__dirname, "../var/tests.html"), `
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
Expand Down

0 comments on commit 10aab5d

Please sign in to comment.