Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ default-members = [
]

[workspace.package]
version = "0.1.0"
version = "0.1.1"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/polymorph-components/polymorph-test"
Expand Down
18 changes: 12 additions & 6 deletions js/browser-driver.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import { fileURLToPath } from "node:url";
/** Where this package self-mounts on the harness server. */
export const MOUNT = "/__component-test";

const PACKAGE_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
// The directory holding this module (and its `viewer/` siblings): the
// package root under the JSR/npm-compat layout, the `js/` subtree in a
// repo checkout — the mount serves `viewer/*` either way.
const PACKAGE_ROOT = dirname(fileURLToPath(import.meta.url));

const MIME = {
".html": "text/html",
Expand All @@ -37,9 +40,12 @@ const MIME = {
* URLs instead). */
export function componentTestImportMap() {
return {
"@polymorph/component-test-js/harness": `${MOUNT}/js/viewer/harness.mjs`,
"@polymorph/component-test-js/context": `${MOUNT}/js/viewer/context.js`,
"@polymorph/component-test-js/imports": `${MOUNT}/js/viewer/imports.mjs`,
"@polymorph/test/harness": `${MOUNT}/viewer/harness.mjs`,
"@polymorph/test/context": `${MOUNT}/viewer/context.js`,
"@polymorph/test/imports": `${MOUNT}/viewer/imports.mjs`,
"@polymorph/component-test-js/harness": `${MOUNT}/viewer/harness.mjs`,
"@polymorph/component-test-js/context": `${MOUNT}/viewer/context.js`,
"@polymorph/component-test-js/imports": `${MOUNT}/viewer/imports.mjs`,
};
}

Expand All @@ -56,9 +62,9 @@ export function buildHarnessPage({ title = "component-test conformance", importM
<title>${title}</title>
<script type="importmap">${map}</script>
<script type="module">
import { runSuitesInPage } from "${MOUNT}/js/viewer/page-runner.mjs";
import { runSuitesInPage } from "${MOUNT}/viewer/page-runner.mjs";
await runSuitesInPage({
workerUrl: "${MOUNT}/js/viewer/browser-worker.mjs",
workerUrl: "${MOUNT}/viewer/browser-worker.mjs",
...${JSON.stringify(config)},
});
</script>`;
Expand Down
17 changes: 12 additions & 5 deletions js/browser-driver.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@ import {
findChrome,
} from "./browser-driver.mjs";

// The import map points every bare specifier at the self-mount.
// The import map points every bare specifier at the self-mount, under
// both the JSR name and the retired npm-facade name.
const map = componentTestImportMap();
for (const [specifier, path] of Object.entries(map)) {
assert.ok(specifier.startsWith("@polymorph/component-test-js/"));
assert.ok(path.startsWith(`${MOUNT}/js/viewer/`));
assert.ok(
specifier.startsWith("@polymorph/test/") ||
specifier.startsWith("@polymorph/component-test-js/"),
);
assert.ok(path.startsWith(`${MOUNT}/viewer/`));
}
for (const name of ["harness", "context", "imports"]) {
assert.equal(map[`@polymorph/test/${name}`], map[`@polymorph/component-test-js/${name}`]);
}

// The page: import map merged with the caller's, config JSON embedded,
Expand All @@ -43,8 +50,8 @@ const html = buildHarnessPage({
});
assert.ok(html.includes(`"my:sut":"/js/sut.js"`), "caller import-map entry");
assert.ok(html.includes(map["@polymorph/component-test-js/harness"]), "self-mount entry");
assert.ok(html.includes(`${MOUNT}/js/viewer/page-runner.mjs`));
assert.ok(html.includes(`${MOUNT}/js/viewer/browser-worker.mjs`));
assert.ok(html.includes(`${MOUNT}/viewer/page-runner.mjs`));
assert.ok(html.includes(`${MOUNT}/viewer/browser-worker.mjs`));
assert.ok(html.includes(`"jco-browser"`), "config embedded");

// findChrome: an executable CHROME_PATH wins outright; a missing one
Expand Down
2 changes: 1 addition & 1 deletion js/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polymorph/test",
"version": "0.1.0",
"version": "0.1.1",
"license": "Apache-2.0",
"//": "The polymorph:test stack's JS runner core on JSR — the same source-only module set the repo-root package.json exports to npm git installs (keep the two export maps in sync). Plain JS with relative and node: imports only; the browser-safe pieces (harness, context, imports, the workers) load in browsers unchanged, and the node: importers (node-runner, browser-driver) are Node/Deno-side drivers. The publish include-list IS the package: everything else under js/ is repo tooling (the deltic runner leg, selftests, the viewer app).",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polymorph/component-test-js",
"version": "0.1.0",
"version": "0.1.1",
"private": false,
"type": "module",
"description": "The polymorph:test stack's JS runner core, consumable as a pinned git dependency (npm git installs cannot select subdirectories, so this facade lives at the repo root). Source-only by design: the browser-safe harness (tag inventory, mark scheduling, the case loop), the test-context provider, and the shard workers (jco- and deltic-shaped). Built artifacts (the viewer-aggregate engine) are deliberately excluded - they wait for registry publishing. Stability policy: unstable 0.x, caret-honest releases (breaking changes bump the minor); pin a release's commit and bump deliberately.",
Expand Down
Loading