Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Fix css coverage issue if using sass variables #644

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion lib/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,12 @@ module.exports = inherit({
}.bind(this), coverageLevel.NONE);

var sourceStart = getPosition(rule.position.start, opts.url, opts.map),
sourceEnd = getPosition(rule.position.end, opts.url, opts.map),
// We're using the start of the last declaration here instead of the
// rule.position.end, because due for example to the use of sass
// variables and a buggy implementation of sourcemaps in both ruby sass
// as well as lib sass the rule end would map to the end of the variable
// declaration instead of the correct end of the css rule
sourceEnd = getPosition(rule.declarations[rule.declarations.length - 1].position.start, opts.url, opts.map),
// Synchronous realpath() is used because of original method is totally synchronous and recursive,
// while the order of recursive calls is important. Making the code being asynchronous won't make
// much benefit considering only one async call can be executed to guarantee the calling order.
Expand Down