Repository navigation
Conversation
`avenx trace export` suggested running the generated test with `node --test <file>`. That runner has no DOM, so mounting the component fails and the resulting error blames the framework instead of the instruction. The generated file's header also never mentioned the DOM requirement, unlike the `--with-test` scaffold. Print `npx vitest run <path>` naming the file that was written, and emit the scaffold's setup header (vitest and happy-dom, plus the environment setting) in generated tests so the file carries its own instructions. Fixes Avenx-JS#1765
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
avenx trace exportcloses with:The generated test mounts a component through
mountTestComponent, andnode --testhas no DOM. Following the printed instruction produces a wall of render-failure output (AVX_R08,AVX_R37) that points at the framework rather than at the instruction. The generated file's header also never mentions the DOM requirement, so once the terminal output is gone the file does not carry its own setup — unlike the--with-testscaffold, which documents it.Root cause
The closing hint in
traceExporthard-codednode --test, andgenerateTestnever emitted the DOM setup block thattemplates/component/component.test.js.templatewrites for--with-test.Fix
bin/commands/trace.js: the closing hint now printsnpx vitest run <path>using the path the export actually wrote, including when--outis passed. That is the runner the component scaffold anddocs/src/content/docs/api-reference/testing.mdrecommend for component tests.lib/core/trace/exportTest.js: generated tests now include the scaffold-style setup header — installvitestandhappy-dom, settest: { environment: 'happy-dom' }, runnpx vitest run— so the file stands on its own.Testing
test/unit/traceExportSetup.test.jsasserts the generated header contains the DOM setup, and that the CLI message namesnpx vitest runplus the file actually written (both the--outpath and the default path), and no longer mentionsnode --test.node test/run-tests.js traceExport: 2/3 files pass.test/system/traceExport.test.jsfails at its recording step withERR_UNSUPPORTED_ESM_URL_SCHEMEbecause--importreceives a Windows absolute path. The same failure reproduces at HEAD with these changes stashed, so it is pre-existing on Windows and unrelated to this change.npm run lint: passes.Checklist
npm run lintpassesnpm test(full suite) not run; affected trace-export suites were run as described aboveFixes #1765