mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-27 12:03:12 +00:00
aaf880c925
* WIP moving tests to web-test-runner * updating thresholds * Adding file extensions * Testing integrations * linting * fixing dep * moving back to root dir * prettier all of the files * updating eslint rules to use with prettier * remove import package * moving tsignore around * removing unneeded ignores * all tests run on puppeteer, no need for testing guards * linting * import type syntax * cleaning up * Update package.json
24 lines
738 B
JavaScript
24 lines
738 B
JavaScript
/**
|
|
* @fileoverview Ensure that the unpkg link can be loaded in the browser
|
|
*/
|
|
import puppeteer from "puppeteer";
|
|
import { fileURLToPath } from "url";
|
|
import { readFile } from "fs/promises";
|
|
import { resolve } from "path";
|
|
import assert from "assert";
|
|
|
|
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
const rootDir = resolve(__dirname, "../../../");
|
|
const pkg = JSON.parse(
|
|
(await readFile(resolve(rootDir, "package.json"))).toString()
|
|
);
|
|
|
|
const browser = await puppeteer.launch();
|
|
const page = await browser.newPage();
|
|
await page.addScriptTag({
|
|
path: resolve(rootDir, pkg.unpkg),
|
|
});
|
|
const time = await page.evaluate("Tone.now()");
|
|
await browser.close();
|
|
|
|
assert(time >= 0, new Error("did not export a time value"));
|