Skip to content

Commit

Permalink
ci: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jul 23, 2024
1 parent b156215 commit 36050bf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
13 changes: 9 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
const [nodeMajor] = process.versions.node.split(".").map(Number);

module.exports = {
testEnvironment: "jest-environment-node-single-context",
moduleNameMapper: {
// For Node.js@22, because `node-sass` doesn't support it
"^node-sass$": "sass",
},
moduleNameMapper:
nodeMajor > 20
? {
// For Node.js@22, because `node-sass` doesn't support it
"^node-sass$": "sass",
}
: {},
};
19 changes: 13 additions & 6 deletions test/helpers/getImplementationsAndAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ import dartSass from "sass";
// eslint-disable-next-line import/no-namespace
import * as SassEmbedded from "sass-embedded";

const [nodeMajor] = process.versions.node.split(".").map(Number);

export default function getImplementationsAndAPI() {
return [
{
name: nodeSass.info.split("\t")[0],
implementation: nodeSass,
api: "legacy",
},
const implementations = [
{
name: dartSass.info.split("\t")[0],
implementation: dartSass,
Expand Down Expand Up @@ -41,4 +38,14 @@ export default function getImplementationsAndAPI() {
api: "modern-compiler",
},
];

if (nodeMajor <= 20) {
implementations.unshift({
name: nodeSass.info.split("\t")[0],
implementation: nodeSass,
api: "legacy",
});
}

return implementations;
}

0 comments on commit 36050bf

Please sign in to comment.