Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Distinguish WASM build packages from test packages

Manav Rathie5d68a7d31af
diff --git a/.github/checks/wasm-ci-paths/check.mjs b/.github/checks/wasm-ci-paths/check.mjs
index 775e837d74..2e91b4918b 100644
--- a/.github/checks/wasm-ci-paths/check.mjs
+++ b/.github/checks/wasm-ci-paths/check.mjs
@@ -52,7 +52,8 @@ function wasmPaths() {
for (const path of globSync("web/packages/wasm/*/package.json", {
cwd: root,
})) {
- const { name } = readJSON(resolve(root, path));
+ const { name, scripts } = readJSON(resolve(root, path));
+ if (!scripts?.build) continue;
const pkg = byName.get(name);
if (!pkg)
throw new Error(`${path}: no matching Cargo package for ${name}`);
diff --git a/.github/checks/wasm-ci-paths/test.mjs b/.github/checks/wasm-ci-paths/test.mjs
index ca1f8edf82..b4289cc6d6 100644
--- a/.github/checks/wasm-ci-paths/test.mjs
+++ b/.github/checks/wasm-ci-paths/test.mjs
@@ -46,7 +46,14 @@ shared-alias = { package = "shared", path = "crates/shared" }
);
write(
"web/packages/wasm/app/package.json",
- JSON.stringify({ name: "app-wasm" }),
+ JSON.stringify({
+ name: "app-wasm",
+ scripts: { build: "wasm-pack build" },
+ }),
+ );
+ write(
+ "web/packages/wasm/tests/package.json",
+ JSON.stringify({ name: "wasm-tests", scripts: { test: "vitest" } }),
);
crate(
"bindings/wasm/app",
@@ -114,4 +121,14 @@ native-only = { path = "../../../crates/native-only" }
assert.equal(result.status, 1);
assert.match(result.stderr, /WASM coverage does not support negated paths/);
assert.equal(result.stdout, "");
+ write(
+ "web/packages/wasm/app/package.json",
+ JSON.stringify({
+ name: "missing-wasm",
+ scripts: { build: "wasm-pack build" },
+ }),
+ );
+ result = run(["rust/**"]);
+ assert.equal(result.status, 1);
+ assert.match(result.stderr, /no matching Cargo package for missing-wasm/);
});