Skip to content

Commit

Permalink
Update the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Oct 22, 2024
1 parent 1cd1d85 commit 40e0a21
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 39 deletions.
39 changes: 39 additions & 0 deletions etc/puppeteer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const console = require("node:console");
const {writeFile} = require("node:fs/promises");
const {createServer} = require("node:http");
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 page = await browser.newPage();
page.on("console", message => console.log(message.text()));
page.on("pageerror", error => console.error(error));

await page.evaluate(() => console.log(navigator.userAgent));
await page.exposeFunction("exit", async code => {
await browser.close();
server.close();
process.exit(code);
});

await writeFile("var/tests.html", `
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<script defer src="tests.js"></script>
</head>
<body></body>
</html>
`);

server.listen(0, "127.0.0.1", () => {
const {address, port} = server.address();
page.goto(`http://${address}:${port}/tests.html`);
});
})();
38 changes: 0 additions & 38 deletions etc/puppeteer.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion test.hxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
--library tink_unittest
--main RunTests
share/build.hxml
--cmd node etc/puppeteer.mjs
--cmd node etc/puppeteer.js

0 comments on commit 40e0a21

Please sign in to comment.