Repository navigation
feat(runner): make TestRunner#viewportScope public for headless runners - #446
Merged
Merged
Conversation
twd-cli plans one pass per viewport from the page. With the scope public it asks twd-js which tests match instead of reimplementing the matching rules.
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.
Part of #444, the hook twd-cli needs for responsive runs.
TestRunner#viewportScope(options?)was private. It is now public, unchanged:{ viewport: 'mobile' }: ids of the tests for that viewport, without resizingnullwhen the app declares no viewportstwd-cli calls it from the page (
new window.__testRunner(events).viewportScope()) to plan one pass per viewport and to check, after each resize, that the width matches. That way the matching rules live only in twd-js.Changes
src/runner.ts:viewportScopedropsprivate, with a doc comment for tools.src/tests/runner/twd-runner-viewport.spec.ts: covers null without viewports, current width, a named viewport,defaultViewport, and access throughwindow.__testRunner. Written first; it failed the type check while the method was private.specs/2026-11-19-responsive-testing-design.md: section 9 describes the refined twd-cli flow (one page load, no reload, each test runs once).628 tests pass, 0 lint errors.