-
-
Notifications
You must be signed in to change notification settings - Fork 76
Closed
Description
Since upgrading to jsdom@27
many of my unit tests started failing with this error. It's really hard to provide a reusable test case, but here is the debugger context of one use case:

When on line 510:
const parsedValue = shorthandItem.parse(longhandValues.join(" ")); <- this returns undefined
const shorthandValue = Object.values(parsedValue).join(" "); <- This blows up
this._setProperty(shorthandProperty, shorthandValue, priority);
Here is the data in the debugger at that point in time:

Digging into the flex.js implementation I end up in this else block:
} else {
const [val1, val2, val3] = value;
if (val1.type === "Calc" && val1.isNumber) {
flex["flex-grow"] = `${val1.name}(${val1.value})`;
} else if (val1.type === "Number") {
flex["flex-grow"] = val1.value;
} else {
return;
}
if (val3) {
if (val2.type === "Calc" && val2.isNumber) {
flex["flex-shrink"] = `${val2.name}(${val2.value})`;
} else if (val2.type === "Number") {
flex["flex-shrink"] = val2.value;
} else {
return;
}
if (val3.type === "Calc" && !val3.isNumber) {
flex["flex-basis"] = `${val3.name}(${val3.value})`;
} else if (val3.type === "Dimension") {
flex["flex-basis"] = `${val3.value}${val3.unit}`;
} else if (val3.type === "Percentage") {
flex["flex-basis"] = `${val3.value}%`;
} else {
return; <- It returns here since val3 is { type: 'Identifier', name: 'auto' }
}
} else {
switch (val2.type) {
case "Calc": {
if (val2.isNumber) {
flex["flex-shrink"] = `${val2.name}(${val2.value})`;
} else {
flex["flex-basis"] = `${val2.name}(${val2.value})`;
}
break;
}
case "Dimension": {
flex["flex-basis"] = `${val2.value}${val2.unit}`;
break;
}
case "Number": {
flex["flex-shrink"] = val2.value;
break;
}
case "Percentage": {
flex["flex-basis"] = `${val2.value}%`;
break;
}
default: {
return;
}
}
}
return flex;
// return [...Object.values(flex)].join(" ");
}
} else if (typeof value === "string") {
return value;
}
};
With this context:

ThiloAschebrock and vezaynk
Metadata
Metadata
Assignees
Labels
No labels