diff --git a/pkgs/create/create.js b/pkgs/create/create.js index ac339b46c..0d11f63d9 100755 --- a/pkgs/create/create.js +++ b/pkgs/create/create.js @@ -216,7 +216,7 @@ create(dir(dest, [ "name": dest, "scripts": { "build": `esbuild --bundle src/main.${ext} --outfile=www/main.js --minify`, - "dev": `esbuild --bundle src/main.${ext} --outfile=www/main.js --servedir=www`, + "dev": `esbuild --bundle --sourcemap --keep-names src/main.${ext} --outfile=www/main.js --servedir=www`, "bundle": "npm run build && mkdir -p dist && zip -r dist/game.zip www -x \"**/.DS_Store\"", ...(ts ? { "check": "tsc", diff --git a/scripts/test.js b/scripts/test.js index 9f40dc4bf..b83b9e025 100644 --- a/scripts/test.js +++ b/scripts/test.js @@ -7,41 +7,35 @@ await build() const port = process.env.PORT || 8001 const server = serve({ port: port }) -const run = async () => { - - let failed = false - console.log("launching browser") - const browser = await puppeteer.launch() - console.log("getting examples list") - const examples = (await fs.readdir("examples")) - .filter((p) => !p.startsWith(".") && p.endsWith(".js")) - .map((d) => path.basename(d, ".js")) - // particle example crashes puppeteer in github action for some reason - .filter((e) => e !== "particle") - - for (const example of examples) { - console.log(`testing example "${example}"`) - const page = await browser.newPage() - page.on("pageerror", (err) => { - failed = true - console.error(example, err) - }) - page.on("error", (err) => { - failed = true - console.error(example, err) - }) - await page.goto(`http://localhost:${port}/${example}`) - await page.addScriptTag({ path: "scripts/autoinput.js" }) - await wait(1000) - await page.close() - } - - browser.close() - server.close() - - console.log(failed ? "fail" : "success") - process.exit(failed ? 1 : 0) - +let failed = false +console.log("launching browser") +const browser = await puppeteer.launch() +console.log("getting examples list") +const examples = (await fs.readdir("examples")) + .filter((p) => !p.startsWith(".") && p.endsWith(".js")) + .map((d) => path.basename(d, ".js")) + // particle example crashes puppeteer in github action for some reason + .filter((e) => e !== "particle") + +for (const example of examples) { + console.log(`testing example "${example}"`) + const page = await browser.newPage() + page.on("pageerror", (err) => { + failed = true + console.error(example, err) + }) + page.on("error", (err) => { + failed = true + console.error(example, err) + }) + await page.goto(`http://localhost:${port}/${example}`) + await page.addScriptTag({ path: "scripts/autoinput.js" }) + await wait(1000) + await page.close() } -run() +browser.close() +server.close() + +console.log(failed ? "fail" : "success") +process.exit(failed ? 1 : 0)