* test(js): add unit tests for pure helper functions in image_profile.js Cover clamp, sanitizeDimension, sanitizeSteps, and parseResolution with 65 tests via node:test (no added dependencies). A minimal scripts/app.js stub satisfies the ComfyUI import without a real installation. Production change is additive-only: named exports appended at the end of the file. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * test(web): make JS test harness self-contained via resolve hook The original harness depended on a stub file resolved OUTSIDE the repo (web/../../scripts/app.js -> a path above the project root) and also committed an unused scripts/app.js at the wrong path. The tests therefore only passed in the authoring worktree and would fail ERR_MODULE_NOT_FOUND on a clean clone, while shipping a stray scripts/app.js in the package. Replace that with a synchronous in-thread resolve hook (module.registerHooks, stable in Node >=24) that redirects any ".../scripts/app.js" import to a tiny in-repo stub (web/__tests__/app-stub.mjs). The suite is now fully reproducible with `npm test` (node --test) — no files outside the repo, no experimental flags. Removed the misplaced scripts/app.js and added a dev-only package.json with a `test` script. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
10 lines
264 B
JSON
10 lines
264 B
JSON
{
|
|
"name": "comfyui-image-profile-web",
|
|
"private": true,
|
|
"type": "module",
|
|
"description": "Dev-only package manifest for running the web/ unit tests with Node's built-in test runner.",
|
|
"scripts": {
|
|
"test": "node --test web/__tests__/*.test.mjs"
|
|
}
|
|
}
|