diff --git a/src/utils.js b/src/utils.js index 529652cd..76d22b36 100644 --- a/src/utils.js +++ b/src/utils.js @@ -889,14 +889,15 @@ function errorFactory(error) { let message; if (error.formatted) { - message = error.formatted.replace(/^Error: /, ""); + message = error.formatted.replace(/^(.+)?Error: /, ""); } else { // Keep original error if `sassError.formatted` is unavailable - ({ message } = error); + message = (error.message || error.toString()).replace(/^(.+)?Error: /, ""); } const obj = new Error(message, { cause: error }); + obj.name = error.name; obj.stack = null; return obj; diff --git a/test/__snapshots__/loader.test.js.no-node-sass.snap b/test/__snapshots__/loader.test.js.no-node-sass.snap index 220772b0..710c7b3b 100644 --- a/test/__snapshots__/loader.test.js.no-node-sass.snap +++ b/test/__snapshots__/loader.test.js.no-node-sass.snap @@ -795,7 +795,7 @@ exports[`loader should not use .import.sass files ('sass-embedded', 'legacy' API exports[`loader should not use .import.sass files ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -804,7 +804,7 @@ exports[`loader should not use .import.sass files ('sass-embedded', 'modern' API exports[`loader should not use .import.sass files ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -849,7 +849,7 @@ exports[`loader should not use .import.scss files ('sass-embedded', 'legacy' API exports[`loader should not use .import.scss files ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -858,7 +858,7 @@ exports[`loader should not use .import.scss files ('sass-embedded', 'modern' API exports[`loader should not use .import.scss files ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -939,7 +939,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'legacy' exports[`loader should output an understandable error ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -948,7 +948,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'modern' exports[`loader should output an understandable error ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -957,7 +957,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'modern' exports[`loader should output an understandable error ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -966,7 +966,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'modern- exports[`loader should output an understandable error ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -1047,7 +1047,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1056,7 +1056,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1065,7 +1065,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1074,7 +1074,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1155,7 +1155,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1164,7 +1164,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1173,7 +1173,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1182,7 +1182,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1263,7 +1263,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -1272,7 +1272,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -1281,7 +1281,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -1290,7 +1290,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -1371,7 +1371,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -1380,7 +1380,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -1389,7 +1389,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -1398,7 +1398,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -3813,7 +3813,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -3822,7 +3822,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -3831,7 +3831,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -3840,7 +3840,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -3849,7 +3849,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -3858,7 +3858,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -3939,7 +3939,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'lega exports[`loader should throw an error on circular import ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -3948,7 +3948,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'mode exports[`loader should throw an error on circular import ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -3957,7 +3957,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'mode exports[`loader should throw an error on circular import ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -3966,7 +3966,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'mode exports[`loader should throw an error on circular import ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -4047,7 +4047,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'legacy' exports[`loader should throw an error on circular use ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Module loop: this module is already being loaded.", +Module loop: this module is already being loaded.", ] `; @@ -4056,7 +4056,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'modern' exports[`loader should throw an error on circular use ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -4065,7 +4065,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'modern' exports[`loader should throw an error on circular use ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Module loop: this module is already being loaded.", +Module loop: this module is already being loaded.", ] `; @@ -4074,7 +4074,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'modern- exports[`loader should throw an error on circular use ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -4155,7 +4155,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4164,7 +4164,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4173,7 +4173,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4182,7 +4182,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4263,7 +4263,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4272,7 +4272,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4281,7 +4281,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4290,7 +4290,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index 92700145..e3384832 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -835,7 +835,7 @@ exports[`loader should not use .import.sass files ('sass-embedded', 'legacy' API exports[`loader should not use .import.sass files ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -844,7 +844,7 @@ exports[`loader should not use .import.sass files ('sass-embedded', 'modern' API exports[`loader should not use .import.sass files ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -889,7 +889,7 @@ exports[`loader should not use .import.scss files ('sass-embedded', 'legacy' API exports[`loader should not use .import.scss files ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -898,7 +898,7 @@ exports[`loader should not use .import.scss files ('sass-embedded', 'modern' API exports[`loader should not use .import.scss files ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -997,7 +997,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'legacy' exports[`loader should output an understandable error ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -1006,7 +1006,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'modern' exports[`loader should output an understandable error ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -1015,7 +1015,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'modern' exports[`loader should output an understandable error ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -1024,7 +1024,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'modern- exports[`loader should output an understandable error ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -1123,7 +1123,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1132,7 +1132,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1141,7 +1141,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1150,7 +1150,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1231,7 +1231,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1240,7 +1240,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1249,7 +1249,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1258,7 +1258,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -1357,7 +1357,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -1366,7 +1366,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -1375,7 +1375,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -1384,7 +1384,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -1465,7 +1465,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -1474,7 +1474,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -1483,7 +1483,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Expected newline.", +Expected newline.", ] `; @@ -1492,7 +1492,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: expected "{".", +expected "{".", ] `; @@ -4337,7 +4337,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -4346,7 +4346,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -4355,7 +4355,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -4364,7 +4364,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -4373,7 +4373,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -4382,7 +4382,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -4481,7 +4481,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'lega exports[`loader should throw an error on circular import ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -4490,7 +4490,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'mode exports[`loader should throw an error on circular import ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -4499,7 +4499,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'mode exports[`loader should throw an error on circular import ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -4508,7 +4508,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'mode exports[`loader should throw an error on circular import ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -4589,7 +4589,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'legacy' exports[`loader should throw an error on circular use ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Module loop: this module is already being loaded.", +Module loop: this module is already being loaded.", ] `; @@ -4598,7 +4598,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'modern' exports[`loader should throw an error on circular use ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -4607,7 +4607,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'modern' exports[`loader should throw an error on circular use ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Module loop: this module is already being loaded.", +Module loop: this module is already being loaded.", ] `; @@ -4616,7 +4616,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'modern- exports[`loader should throw an error on circular use ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -4715,7 +4715,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4724,7 +4724,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4733,7 +4733,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4742,7 +4742,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4823,7 +4823,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4832,7 +4832,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4841,7 +4841,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -4850,7 +4850,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -Error: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; diff --git a/test/__snapshots__/sassOptions-option.test.js.no-node-sass.snap b/test/__snapshots__/sassOptions-option.test.js.no-node-sass.snap index 63839f8b..18191869 100644 --- a/test/__snapshots__/sassOptions-option.test.js.no-node-sass.snap +++ b/test/__snapshots__/sassOptions-option.test.js.no-node-sass.snap @@ -1224,6 +1224,78 @@ exports[`sassOptions option should ignore the "url" option ('sass-embedded', 'mo exports[`sassOptions option should ignore the "url" option ('sass-embedded', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +method not found: 'get$iterator' (J.getInterceptor$ax(...).get$iterator is not a function)", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +method not found: 'get$iterator' (J.getInterceptor$ax(...).get$iterator is not a function)", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +method not found: 'get$iterator' (J.getInterceptor$ax(...).get$iterator is not a function)", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +method not found: 'get$iterator' (J.getInterceptor$ax(...).get$iterator is not a function)", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +arr.flatMap is not a function", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +arr.flatMap is not a function", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +arr.flatMap is not a function", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +arr.flatMap is not a function", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; + exports[`sassOptions option should respect the "outputStyle"/"style" option ('dart-sass', 'legacy' API, 'sass' syntax): css 1`] = ` "@charset "UTF-8"; @import "./file.css"; @@ -4388,6 +4460,78 @@ exports[`sassOptions option should work with custom scheme import ('sass-embedde exports[`sassOptions option should work with custom scheme import ('sass-embedded', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; + exports[`sassOptions option should work with the "functions" option ('dart-sass', 'legacy' API, 'sass' syntax): css 1`] = ` "h2, h3, h4, h5 { color: #08c; diff --git a/test/__snapshots__/sassOptions-option.test.js.snap b/test/__snapshots__/sassOptions-option.test.js.snap index cbf776e6..142a15fc 100644 --- a/test/__snapshots__/sassOptions-option.test.js.snap +++ b/test/__snapshots__/sassOptions-option.test.js.snap @@ -1404,6 +1404,78 @@ exports[`sassOptions option should ignore the "url" option ('sass-embedded', 'mo exports[`sassOptions option should ignore the "url" option ('sass-embedded', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +method not found: 'get$iterator' (J.getInterceptor$ax(...).get$iterator is not a function)", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +method not found: 'get$iterator' (J.getInterceptor$ax(...).get$iterator is not a function)", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +method not found: 'get$iterator' (J.getInterceptor$ax(...).get$iterator is not a function)", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +method not found: 'get$iterator' (J.getInterceptor$ax(...).get$iterator is not a function)", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +arr.flatMap is not a function", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +arr.flatMap is not a function", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +arr.flatMap is not a function", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +arr.flatMap is not a function", +] +`; + +exports[`sassOptions option should output a normal error with the wrong "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; + exports[`sassOptions option should respect the "outputStyle"/"style" option ('dart-sass', 'legacy' API, 'sass' syntax): css 1`] = ` "@charset "UTF-8"; @import "./file.css"; @@ -5054,6 +5126,78 @@ exports[`sassOptions option should work with custom scheme import ('sass-embedde exports[`sassOptions option should work with custom scheme import ('sass-embedded', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('dart-sass', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern' API, 'scss' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'sass' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'sass' syntax): warnings 1`] = `[]`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'scss' syntax): errors 1`] = ` +[ + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.", +] +`; + +exports[`sassOptions option should work with the "fatalDeprecations" option ('sass-embedded', 'modern-compiler' API, 'scss' syntax): warnings 1`] = `[]`; + exports[`sassOptions option should work with the "functions" option ('dart-sass', 'legacy' API, 'sass' syntax): css 1`] = ` "h2, h3, h4, h5 { color: #08c; diff --git a/test/sass/slash-div.sass b/test/sass/slash-div.sass new file mode 100644 index 00000000..4e70128c --- /dev/null +++ b/test/sass/slash-div.sass @@ -0,0 +1,5 @@ +.example + color: red + + a + font-weight: (4/2) diff --git a/test/sassOptions-option.test.js b/test/sassOptions-option.test.js index b36933f2..c33f5057 100644 --- a/test/sassOptions-option.test.js +++ b/test/sassOptions-option.test.js @@ -524,6 +524,44 @@ describe("sassOptions option", () => { await close(compiler); }); + + if (isModernAPI) { + it(`should output a normal error with the wrong "fatalDeprecations" option ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { + const testId = getTestId("language", syntax); + const options = { + implementation, + api, + sassOptions: { + fatalDeprecations: "test", + }, + }; + const compiler = getCompiler(testId, { loader: { options } }); + const stats = await compile(compiler); + + expect(getWarnings(stats)).toMatchSnapshot("warnings"); + expect(getErrors(stats)).toMatchSnapshot("errors"); + + await close(compiler); + }); + + it(`should work with the "fatalDeprecations" option ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { + const testId = getTestId("slash-div", syntax); + const options = { + implementation, + api, + sassOptions: { + fatalDeprecations: ["slash-div"], + }, + }; + const compiler = getCompiler(testId, { loader: { options } }); + const stats = await compile(compiler); + + expect(getWarnings(stats)).toMatchSnapshot("warnings"); + expect(getErrors(stats)).toMatchSnapshot("errors"); + + await close(compiler); + }); + } }); }); }); diff --git a/test/scss/slash-div.scss b/test/scss/slash-div.scss new file mode 100644 index 00000000..91a315e4 --- /dev/null +++ b/test/scss/slash-div.scss @@ -0,0 +1,7 @@ +.example { + color: red; + + a { + font-weight: (4/2); + } +}