Initial Commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Build-artifact tests. Assume `bunx turbo build --filter=@suaveplan/storage-uri-plugin-bundle`
|
||||
* has already produced `dist/`. The repo's turbo pipeline always builds before test.
|
||||
* If you run these in isolation, run `bun run build` first.
|
||||
*/
|
||||
import { readFileSync, statSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "@suaveplan/testing/runner";
|
||||
|
||||
const distDir = fileURLToPath(new URL("../../dist/", import.meta.url));
|
||||
|
||||
describe("storage-uri-plugin-bundle build artifacts", () => {
|
||||
it("build emits a non-empty dist/node-fetch/node-fetch.js", {
|
||||
timeout: 30000,
|
||||
}, () => {
|
||||
const path = `${distDir}node-fetch/node-fetch.js`;
|
||||
const stat = statSync(path);
|
||||
expect(stat.isFile()).toBe(true);
|
||||
expect(stat.size).toBeGreaterThan(0);
|
||||
expect(path.endsWith(".js")).toBe(true);
|
||||
});
|
||||
|
||||
it("dist/index.js contains no node: imports", { timeout: 30000 }, () => {
|
||||
const source = readFileSync(`${distDir}index.js`, "utf8");
|
||||
expect(source).not.toMatch(/from\s+["']node:/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user