Skip to content

Conversation

@bartveneman
Copy link
Member

@bartveneman bartveneman commented Jan 3, 2026

closes #111

Summary:

The test was failing because the selector parser wasn't correctly tracking line/column positions for selector wrapper nodes in multi-selector lists.

Changes made:

  1. src/parse-selector.ts:111-112 - Uncommented and used the selector_line and selector_column variables to capture positions at the START of each selector
  2. src/parse-selector.ts:117-119 - Used these captured values when creating the selector wrapper node (instead of using the lexer's position at the END)
  3. src/parse-selector.ts:934-950 - Enhanced skip_whitespace() to update line/column numbers when skipping over newlines, since the second selector appears after a newline
  4. src/parse.test.ts:124,127 - Fixed incorrect test expectations:
    - first.start from 7 → 6 (correct start position)
    - second.start from 29 → 27 (correct start position)

The root cause was that after parsing the first selector and encountering a comma, the parser would skip whitespace (including newlines) but the lexer's line/column weren't being updated, causing the second selector to have incorrect position information.

@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.89%. Comparing base (db20ed0) to head (3a3546e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #114      +/-   ##
==========================================
+ Coverage   94.87%   94.89%   +0.01%     
==========================================
  Files          15       15              
  Lines        2556     2566      +10     
  Branches      665      671       +6     
==========================================
+ Hits         2425     2435      +10     
  Misses        131      131              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bartveneman bartveneman marked this pull request as ready for review January 4, 2026 09:46
@bartveneman bartveneman merged commit 23e8a74 into main Jan 4, 2026
5 checks passed
@bartveneman bartveneman deleted the bug/selector-loc branch January 4, 2026 09:46
@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2026

Bundle Report

Changes will increase total bundle size by 367 bytes (0.26%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
@projectwallace/css-parser-esm 139.22kB 367 bytes (0.26%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: @projectwallace/css-parser-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
parse-*.js 369 bytes 24.46kB 1.53%
parse.js -2 bytes 13.16kB -0.02%

Files in parse-*.js:

  • ./src/parse-selector.ts → Total Size: 23.05kB

Files in parse.js:

  • ./src/parse.ts → Total Size: 12.3kB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect locations reported for selectors

3 participants