ReMe/reme_studio/tests/static-build.test.mjs
jinliyl ef3f99f019
refactor(packaging): reorganize published packages (#495)
* refactor(packaging): reorganize published packages

* fix(packaging): install AgentScope extra in wheel smoke

* docs: align package guides and documentation site

* ci(workflow): add core dependency verification step in Python package build

- Add a workflow step to verify released core dependencies by installing the wheel with core extras
- Assert the presence of the static index.html file to ensure proper package contents
- Create and use a temporary virtual environment for isolation during verification
- Keep existing artifacts upload step intact and conditional on inputs.upload_artifacts flag

* fix(ci): update package installation dependencies in Windows workflow

- Change pip install from editable reme_studio and core to only dev and as extras
- Remove installation of reme_studio and core to streamline dependency setup
- Ensure Windows CI uses the correct extras for testing environment

* fix(tests): add missing commas in toml file reads in package version tests

- Added trailing commas in the tomllib.loads calls for auto-fin and daily_paper configs
- Ensured consistent syntax to prevent potential tuple misinterpretation
- Improved readability and correctness of the test setup code

* fix(packaging): protect qwenpaw releases and test Studio health
2026-08-27 14:02:09 +08:00

37 lines
1.1 KiB
JavaScript

import assert from "node:assert/strict";
import { readFile, readdir } from "node:fs/promises";
import test from "node:test";
import { fileURLToPath } from "node:url";
test("static build contains the ReMe workspace entry and assets", async () => {
const output = fileURLToPath(new URL("../dist-static/", import.meta.url));
const html = await readFile(
new URL("../dist-static/index.html", import.meta.url),
"utf8",
);
const assets = await readdir(
new URL("../dist-static/assets/", import.meta.url),
);
const javascript = (
await Promise.all(
assets
.filter((name) => name.endsWith(".js"))
.map((name) =>
readFile(new URL(`../dist-static/assets/${name}`, import.meta.url)),
),
)
).join("\n");
assert.match(html, /<title>ReMe Workspace<\/title>/i);
assert.match(html, /<div id="root"><\/div>/i);
assert.match(html, /<script type="module"[^>]+src="\/assets\//i);
assert.ok(
assets.some((name) => name.endsWith(".js")),
output,
);
assert.ok(
assets.some((name) => name.endsWith(".css")),
output,
);
assert.doesNotMatch(javascript, /http:\/\/127\.0\.0\.1:2333/);
});