diff --git a/README.md b/README.md index 225be48d..5ac0ba9f 100644 --- a/README.md +++ b/README.md @@ -249,85 +249,6 @@ module.exports = { }; ``` -Note that when using `sass` (`Dart Sass`), **synchronous compilation is twice as fast as asynchronous compilation** by default, due to the overhead of asynchronous callbacks. -To avoid this overhead, you can use the [fibers](https://www.npmjs.com/package/fibers) package to call asynchronous importers from the synchronous code path. - -We automatically inject the [`fibers`](https://github.com/laverdet/node-fibers) package (setup `sassOptions.fiber`) for `Node.js` less v16.0.0 if is possible (i.e. you need install the [`fibers`](https://github.com/laverdet/node-fibers) package). - -> **Warning** -> -> Fibers is not compatible with `Node.js` v16.0.0 or later. Unfortunately, v8 commit [dacc2fee0f](https://github.com/v8/v8/commit/dacc2fee0f815823782a7e432c79c2a7767a4765) is a breaking change and workarounds are non-trivial. ([see introduction to readme](https://github.com/laverdet/node-fibers)). - -**package.json** - -```json -{ - "devDependencies": { - "sass-loader": "^7.2.0", - "sass": "^1.22.10", - "fibers": "^4.0.1" - } -} -``` - -You can disable automatically injecting the [`fibers`](https://github.com/laverdet/node-fibers) package by passing a `false` value for the `sassOptions.fiber` option. - -**webpack.config.js** - -```js -module.exports = { - module: { - rules: [ - { - test: /\.s[ac]ss$/i, - use: [ - "style-loader", - "css-loader", - { - loader: "sass-loader", - options: { - implementation: require("sass"), - sassOptions: { - fiber: false, - }, - }, - }, - ], - }, - ], - }, -}; -``` - -You can also pass the `fiber` value using this code: - -**webpack.config.js** - -```js -module.exports = { - module: { - rules: [ - { - test: /\.s[ac]ss$/i, - use: [ - "style-loader", - "css-loader", - { - loader: "sass-loader", - options: { - implementation: require("sass"), - sassOptions: { - fiber: require("fibers"), - }, - }, - }, - ], - }, - ], - }, -}; -``` - ### `sassOptions` Type: @@ -338,7 +259,7 @@ type sassOptions = | (( content: string | Buffer, loaderContext: LoaderContext, - meta: any + meta: any, ) => import("sass").LegacyOptions<"async">); ``` diff --git a/src/index.js b/src/index.js index 1541518f..e1fc3d7b 100644 --- a/src/index.js +++ b/src/index.js @@ -39,7 +39,7 @@ async function loader(content) { options, content, implementation, - useSourceMap + useSourceMap, ); const shouldUseWebpackImporter = typeof options.webpackImporter === "boolean" @@ -53,11 +53,11 @@ async function loader(content) { const { includePaths } = sassOptions; sassOptions.importer.push( - getWebpackImporter(this, implementation, includePaths) + getWebpackImporter(this, implementation, includePaths), ); } else { sassOptions.importers.push( - getModernWebpackImporter(this, implementation) + getModernWebpackImporter(this, implementation), ); } } @@ -97,8 +97,8 @@ async function loader(content) { result.sourceMap ? result.sourceMap : result.map - ? JSON.parse(result.map) - : null; + ? JSON.parse(result.map) + : null; // Modify source paths only for webpack, otherwise we do nothing if (map && useSourceMap) { @@ -108,7 +108,7 @@ async function loader(content) { // Modern API if (typeof result.loadedUrls !== "undefined") { result.loadedUrls - .filter((url) => url.protocol === "file:") + .filter((loadedUrl) => loadedUrl.protocol === "file:") .forEach((includedFile) => { const normalizedIncludedFile = url.fileURLToPath(includedFile); diff --git a/src/utils.js b/src/utils.js index 9b9895c6..14f63b31 100644 --- a/src/utils.js +++ b/src/utils.js @@ -82,16 +82,10 @@ function proxyCustomImporters(importers, loaderContext) { const self = { ...this, webpackLoaderContext: loaderContext }; return importer.apply(self, args); - } + }, ); } -function isSupportedFibers() { - const [nodeVersion] = process.versions.node.split("."); - - return Number(nodeVersion) < 16; -} - /** * Derives the sass options from the loader context and normalizes its values with sane defaults. * @@ -107,7 +101,7 @@ async function getSassOptions( loaderOptions, content, implementation, - useSourceMap + useSourceMap, ) { const options = loaderOptions.sassOptions ? typeof loaderOptions.sassOptions === "function" @@ -216,34 +210,6 @@ async function getSassOptions( } else { sassOptions.file = resourcePath; - const isDartSass = implementation.info.includes("dart-sass"); - - if (isDartSass && isSupportedFibers()) { - const shouldTryToResolveFibers = - !sassOptions.fiber && sassOptions.fiber !== false; - - if (shouldTryToResolveFibers) { - let fibers; - - try { - fibers = require.resolve("fibers"); - } catch (_error) { - // Nothing - } - - if (fibers) { - // eslint-disable-next-line global-require, import/no-dynamic-require - sassOptions.fiber = require(fibers); - } - } else if (sassOptions.fiber === false) { - // Don't pass the `fiber` option for `sass` (`Dart Sass`) - delete sassOptions.fiber; - } - } else { - // Don't pass the `fiber` option for `node-sass` - delete sassOptions.fiber; - } - // opt.outputStyle if (!sassOptions.outputStyle && isProductionLikeMode(loaderContext)) { sassOptions.outputStyle = "compressed"; @@ -259,7 +225,7 @@ async function getSassOptions( sassOptions.sourceMap = true; sassOptions.outFile = path.join( loaderContext.rootContext, - "style.css.map" + "style.css.map", ); sassOptions.sourceMapContents = true; sassOptions.omitSourceMapUrl = true; @@ -285,7 +251,7 @@ async function getSassOptions( Array.isArray(sassOptions.importer) ? sassOptions.importer.slice() : [sassOptions.importer], - loaderContext + loaderContext, ) : []; @@ -294,6 +260,7 @@ async function getSassOptions( loaderOptions.webpackImporter === false && sassOptions.importer.length === 0 ) { + // eslint-disable-next-line no-undefined sassOptions.importer = undefined; } @@ -305,15 +272,15 @@ async function getSassOptions( (includePath) => path.isAbsolute(includePath) ? includePath - : path.join(process.cwd(), includePath) - ) + : path.join(process.cwd(), includePath), + ), ) .concat( process.env.SASS_PATH ? process.env.SASS_PATH.split( - process.platform === "win32" ? ";" : ":" + process.platform === "win32" ? ";" : ":", ) - : [] + : [], ); if (typeof sassOptions.charset === "undefined") { @@ -354,7 +321,7 @@ function getPossibleRequests( // eslint-disable-next-line no-shadow url, forWebpackResolver = false, - fromImport = false + fromImport = false, ) { let request = url; @@ -401,13 +368,13 @@ function getPossibleRequests( `${normalizedDirname}_${basenameWithoutExtension}.import${extension}`, `${normalizedDirname}${basenameWithoutExtension}.import${extension}`, ] - : [] + : [], ) .concat([ `${normalizedDirname}_${basename}`, `${normalizedDirname}${basename}`, ]) - .concat(forWebpackResolver ? [url] : []) + .concat(forWebpackResolver ? [url] : []), ), ]; } @@ -480,7 +447,7 @@ const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i; function getWebpackResolver( resolverFactory, implementation, - includePaths = [] + includePaths = [], ) { const isDartSass = implementation && implementation.info.includes("dart-sass"); @@ -505,7 +472,7 @@ function getWebpackResolver( modules: [], restrictions: [/\.((sa|sc|c)ss)$/i], preferRelative: true, - }) + }), ); const sassImportResolve = promiseResolve( resolverFactory({ @@ -520,7 +487,7 @@ function getWebpackResolver( modules: [], restrictions: [/\.((sa|sc|c)ss)$/i], preferRelative: true, - }) + }), ); const webpackModuleResolve = promiseResolve( resolverFactory({ @@ -531,7 +498,7 @@ function getWebpackResolver( extensions: [".sass", ".scss", ".css"], restrictions: [/\.((sa|sc|c)ss)$/i], preferRelative: true, - }) + }), ); const webpackImportResolve = promiseResolve( resolverFactory({ @@ -542,7 +509,7 @@ function getWebpackResolver( extensions: [".sass", ".scss", ".css"], restrictions: [/\.((sa|sc|c)ss)$/i], preferRelative: true, - }) + }), ); return (context, request, fromImport) => { @@ -592,7 +559,7 @@ function getWebpackResolver( const sassPossibleRequests = getPossibleRequests( request, false, - fromImport + fromImport, ); // `node-sass` calls our importer before `1. Filesystem imports relative to the base file.`, so we need emulate this too @@ -612,14 +579,14 @@ function getWebpackResolver( context, possibleRequests: sassPossibleRequests, }; - }) + }), ); } const webpackPossibleRequests = getPossibleRequests( request, true, - fromImport + fromImport, ); resolutionMap = resolutionMap.concat({ @@ -649,7 +616,7 @@ function getWebpackImporter(loaderContext, implementation, includePaths) { const resolve = getWebpackResolver( loaderContext.getResolve, implementation, - includePaths + includePaths, ); return function importer(originalUrl, prev, done) { @@ -724,7 +691,7 @@ function getCompileFn(implementation, options) { nodeSassJobQueue = async.queue( implementation.render.bind(implementation), - threadPoolSize - 1 + threadPoolSize - 1, ); } @@ -740,7 +707,7 @@ function getCompileFn(implementation, options) { } resolve(result); - } + }, ); }); } @@ -825,6 +792,5 @@ export { getWebpackImporter, getCompileFn, normalizeSourceMap, - isSupportedFibers, errorFactory, }; diff --git a/test/__snapshots__/sassOptions-option.test.js.snap b/test/__snapshots__/sassOptions-option.test.js.snap index 12f5057b..01221eae 100644 --- a/test/__snapshots__/sassOptions-option.test.js.snap +++ b/test/__snapshots__/sassOptions-option.test.js.snap @@ -1,299 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('dart-sass', 'legacy' API, 'sass' syntax): css 1`] = ` -"@charset "UTF-8"; -@import "./file.css"; -body { - font: 100% Helvetica, sans-serif; - color: #333; -} - -nav ul { - margin: 0; - padding: 0; - list-style: none; -} -nav li { - display: inline-block; -} -nav a { - display: block; - padding: 6px 12px; - text-decoration: none; -} - -.box { - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - -ms-border-radius: 10px; - border-radius: 10px; -} - -.message, .warning, .error, .success { - border: 1px solid #ccc; - padding: 10px; - color: #333; -} - -.success { - border-color: green; -} - -.error { - border-color: red; -} - -.warning { - border-color: yellow; -} - -.foo:before { - content: "\\e0c6"; -} - -.bar:before { - content: "∑"; -}" -`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('dart-sass', 'legacy' API, 'sass' syntax): warnings 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('dart-sass', 'legacy' API, 'scss' syntax): css 1`] = ` -"@charset "UTF-8"; -@import "./file.css"; -body { - font: 100% Helvetica, sans-serif; - color: #333; -} - -nav ul { - margin: 0; - padding: 0; - list-style: none; -} -nav li { - display: inline-block; -} -nav a { - display: block; - padding: 6px 12px; - text-decoration: none; -} - -.box { - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - -ms-border-radius: 10px; - border-radius: 10px; -} - -.foo:before { - content: "\\e0c6"; -} - -.bar:before { - content: "∑"; -}" -`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('dart-sass', 'legacy' API, 'scss' syntax): warnings 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('node-sass', 'legacy' API, 'sass' syntax): css 1`] = ` -"@charset "UTF-8"; -@import url(./file.css); -body { - font: 100% Helvetica, sans-serif; - color: #333; } - -nav ul { - margin: 0; - padding: 0; - list-style: none; } - -nav li { - display: inline-block; } - -nav a { - display: block; - padding: 6px 12px; - text-decoration: none; } - -.box { - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - -ms-border-radius: 10px; - border-radius: 10px; } - -.message, .success, .error, .warning { - border: 1px solid #ccc; - padding: 10px; - color: #333; } - -.success { - border-color: green; } - -.error { - border-color: red; } - -.warning { - border-color: yellow; } - -.foo:before { - content: ""; } - -.bar:before { - content: "∑"; } -" -`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('node-sass', 'legacy' API, 'sass' syntax): errors 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('node-sass', 'legacy' API, 'sass' syntax): warnings 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('node-sass', 'legacy' API, 'scss' syntax): css 1`] = ` -"@charset "UTF-8"; -@import url(./file.css); -body { - font: 100% Helvetica, sans-serif; - color: #333; } - -nav ul { - margin: 0; - padding: 0; - list-style: none; } - -nav li { - display: inline-block; } - -nav a { - display: block; - padding: 6px 12px; - text-decoration: none; } - -.box { - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - -ms-border-radius: 10px; - border-radius: 10px; } - -.foo:before { - content: ""; } - -.bar:before { - content: "∑"; } -" -`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('node-sass', 'legacy' API, 'scss' syntax): errors 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('node-sass', 'legacy' API, 'scss' syntax): warnings 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('sass-embedded', 'legacy' API, 'sass' syntax): css 1`] = ` -"@charset "UTF-8"; -@import "./file.css"; -body { - font: 100% Helvetica, sans-serif; - color: #333; -} - -nav ul { - margin: 0; - padding: 0; - list-style: none; -} -nav li { - display: inline-block; -} -nav a { - display: block; - padding: 6px 12px; - text-decoration: none; -} - -.box { - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - -ms-border-radius: 10px; - border-radius: 10px; -} - -.message, .warning, .error, .success { - border: 1px solid #ccc; - padding: 10px; - color: #333; -} - -.success { - border-color: green; -} - -.error { - border-color: red; -} - -.warning { - border-color: yellow; -} - -.foo:before { - content: "\\e0c6"; -} - -.bar:before { - content: "∑"; -}" -`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('sass-embedded', 'legacy' API, 'sass' syntax): warnings 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('sass-embedded', 'legacy' API, 'scss' syntax): css 1`] = ` -"@charset "UTF-8"; -@import "./file.css"; -body { - font: 100% Helvetica, sans-serif; - color: #333; -} - -nav ul { - margin: 0; - padding: 0; - list-style: none; -} -nav li { - display: inline-block; -} -nav a { - display: block; - padding: 6px 12px; - text-decoration: none; -} - -.box { - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - -ms-border-radius: 10px; - border-radius: 10px; -} - -.foo:before { - content: "\\e0c6"; -} - -.bar:before { - content: "∑"; -}" -`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = `[]`; - -exports[`sassOptions option should don't use the "fibers" package when the "fiber" option is "false" ('sass-embedded', 'legacy' API, 'scss' syntax): warnings 1`] = `[]`; - exports[`sassOptions option should ignore the "data" option ('dart-sass', 'legacy' API, 'sass' syntax): css 1`] = ` "@charset "UTF-8"; @import "./file.css"; diff --git a/test/helpers/getCodeFromBundle.js b/test/helpers/getCodeFromBundle.js index 9fb2b3ed..3846e54d 100644 --- a/test/helpers/getCodeFromBundle.js +++ b/test/helpers/getCodeFromBundle.js @@ -22,7 +22,7 @@ function getCodeFromBundle(stats, compiler, asset) { `${code};\nmodule.exports = sassLoaderExport;`, { module: {}, - } + }, ); return result.default; diff --git a/test/helpers/getCodeFromSass.js b/test/helpers/getCodeFromSass.js index 2b4e4d4b..7196a1bf 100644 --- a/test/helpers/getCodeFromSass.js +++ b/test/helpers/getCodeFromSass.js @@ -1,4 +1,4 @@ -import url from "url"; +import { pathToFileURL } from "url"; import path from "path"; import fs from "fs"; @@ -35,7 +35,7 @@ async function getCodeFromSass(testId, options, context = {}) { isIndentedSyntax ? "\n" : ";" }\n${fs.readFileSync(path.resolve(__dirname, "..", testId), "utf8")}`; } else if (isModernAPI) { - const URL = url.pathToFileURL(path.resolve(__dirname, "..", testId)); + const URL = pathToFileURL(path.resolve(__dirname, "..", testId)); sassOptions.url = URL; sassOptions.data = fs.readFileSync(URL).toString(); @@ -47,96 +47,97 @@ async function getCodeFromSass(testId, options, context = {}) { const testNodeModules = path.resolve(testFolder, "node_modules") + path.sep; const pathToSassPackageWithIndexFile = path.resolve( testFolder, - "node_modules/sass-package-with-index/index.sass" + "node_modules/sass-package-with-index/index.sass", ); const pathToSassPackageWithExportsFields = path.resolve( testFolder, - "node_modules/package-with-exports/style.scss" + "node_modules/package-with-exports/style.scss", ); const pathToSassPackageWithExportsFieldsAndCustomConditionReplacer = () => { if (context.packageExportsCustomConditionTestVariant === 1) { return path.resolve( testFolder, - "node_modules/package-with-exports-and-custom-condition/style-1.scss" + "node_modules/package-with-exports-and-custom-condition/style-1.scss", ); } if (context.packageExportsCustomConditionTestVariant === 2) { return path.resolve( testFolder, - "node_modules/package-with-exports-and-custom-condition/style-2.scss" + "node_modules/package-with-exports-and-custom-condition/style-2.scss", ); } + // eslint-disable-next-line no-console console.warn( - "Expected to receive .packageExportsCustomConditionTestVariant to properly resolve stylesheet in sass only compilation. " + "Expected to receive .packageExportsCustomConditionTestVariant to properly resolve stylesheet in sass only compilation. ", ); return ""; }; const pathToSCSSPackageWithIndexFile = path.resolve( testFolder, - "node_modules/scss-package-with-index/index.scss" + "node_modules/scss-package-with-index/index.scss", ); const pathToSassPackageWithUnderscoreIndexFile = path.resolve( testFolder, - "node_modules/sass-package-with-underscore-index/_index.sass" + "node_modules/sass-package-with-underscore-index/_index.sass", ); const pathToSCSSPackageWithUnderscoreIndexFile = path.resolve( testFolder, - "node_modules/scss-package-with-underscore-index/_index.scss" + "node_modules/scss-package-with-underscore-index/_index.scss", ); const pathToSCSSUnderscoreDir = path.resolve( testFolder, - "scss/_underscore-dir/_index.scss" + "scss/_underscore-dir/_index.scss", ); const pathToSCSSUnderscoreDir1 = path.resolve( testFolder, - "scss/_underscore-dir-1/index.scss" + "scss/_underscore-dir-1/index.scss", ); const pathToSCSSUnderscoreDir2 = path.resolve( testFolder, - "scss/_underscore-dir-2/_index.sass" + "scss/_underscore-dir-2/_index.sass", ); const pathToSCSSUnderscoreDir3 = path.resolve( testFolder, - "scss/_underscore-dir-3/index.sass" + "scss/_underscore-dir-3/index.sass", ); // Avoid `.css` extensions because `node-sass` doesn't compile them const pathToSCSSUnderscoreDir4 = path.resolve( testFolder, - "scss/_underscore-dir-4/_index" + "scss/_underscore-dir-4/_index", ); // Avoid `.css` extensions because `node-sass` doesn't compile them const pathToSCSSUnderscoreDir5 = path.resolve( testFolder, - "scss/_underscore-dir-5/index" + "scss/_underscore-dir-5/index", ); const pathToSassUnderscoreDir = path.resolve( testFolder, - "sass/_underscore-dir/_index.sass" + "sass/_underscore-dir/_index.sass", ); const pathToSassUnderscoreDir1 = path.resolve( testFolder, - "sass/_underscore-dir-1/index.sass" + "sass/_underscore-dir-1/index.sass", ); const pathToSassUnderscoreDir2 = path.resolve( testFolder, - "sass/_underscore-dir-2/_index.scss" + "sass/_underscore-dir-2/_index.scss", ); const pathToSassUnderscoreDir3 = path.resolve( testFolder, - "sass/_underscore-dir-3/index.scss" + "sass/_underscore-dir-3/index.scss", ); // Avoid `.css` extensions because `node-sass` doesn't compile them const pathToSassUnderscoreDir4 = path.resolve( testFolder, - "sass/_underscore-dir-4/_index" + "sass/_underscore-dir-4/_index", ); // Avoid `.css` extensions because `node-sass` doesn't compile them const pathToSassUnderscoreDir5 = path.resolve( testFolder, - "sass/_underscore-dir-5/index" + "sass/_underscore-dir-5/index", ); const pathToSCSSWord6 = path.resolve(testFolder, "scss/word-6/_index.scss"); const pathToSCSSWord7 = path.resolve(testFolder, "scss/word-7/index.scss"); @@ -146,27 +147,27 @@ async function getCodeFromSass(testId, options, context = {}) { const pathToSCSSWord11 = path.resolve(testFolder, "scss/word-11/index"); const pathToSCSSDirectory6 = path.resolve( testFolder, - "scss/directory-6/file/_index.scss" + "scss/directory-6/file/_index.scss", ); const pathToSCSSDirectory7 = path.resolve( testFolder, - "scss/directory-7/file/index.scss" + "scss/directory-7/file/index.scss", ); const pathToSCSSDirectory8 = path.resolve( testFolder, - "scss/directory-8/file/_index.sass" + "scss/directory-8/file/_index.sass", ); const pathToSCSSDirectory9 = path.resolve( testFolder, - "scss/directory-9/file/index.sass" + "scss/directory-9/file/index.sass", ); const pathToSCSSDirectory10 = path.resolve( testFolder, - "scss/directory-10/file/index" + "scss/directory-10/file/index", ); const pathToSCSSDirectory11 = path.resolve( testFolder, - "scss/directory-11/file/index" + "scss/directory-11/file/index", ); const pathToSassWord6 = path.resolve(testFolder, "sass/word-6/_index.sass"); const pathToSassWord7 = path.resolve(testFolder, "sass/word-7/index.sass"); @@ -176,145 +177,145 @@ async function getCodeFromSass(testId, options, context = {}) { const pathToSassWord11 = path.resolve(testFolder, "sass/word-11/index"); const pathToSassDirectory6 = path.resolve( testFolder, - "sass/directory-6/file/_index.sass" + "sass/directory-6/file/_index.sass", ); const pathToSassDirectory7 = path.resolve( testFolder, - "sass/directory-7/file/index.sass" + "sass/directory-7/file/index.sass", ); const pathToSassDirectory8 = path.resolve( testFolder, - "sass/directory-8/file/_index.scss" + "sass/directory-8/file/_index.scss", ); const pathToSassDirectory9 = path.resolve( testFolder, - "sass/directory-9/file/index.scss" + "sass/directory-9/file/index.scss", ); const pathToSassDirectory10 = path.resolve( testFolder, - "sass/directory-10/file/index" + "sass/directory-10/file/index", ); const pathToSassDirectory11 = path.resolve( testFolder, - "sass/directory-11/file/index" + "sass/directory-11/file/index", ); const pathToAlias = path.resolve( testFolder, path.extname(testId).slice(1), "another", - `alias.${path.extname(testId).slice(1)}` + `alias.${path.extname(testId).slice(1)}`, ); const pathToSCSSSassField = path.resolve( testFolder, - "node_modules/scss-sass-field/nested/style.scss" + "node_modules/scss-sass-field/nested/style.scss", ); const pathToSassSassField = path.resolve( testFolder, - "node_modules/sass-sass-field/nested/style.sass" + "node_modules/sass-sass-field/nested/style.sass", ); const pathToSCSSStyleField = path.resolve( testFolder, - "node_modules/scss-style-field/nested/style.scss" + "node_modules/scss-style-field/nested/style.scss", ); const pathToSassStyleField = path.resolve( testFolder, - "node_modules/sass-style-field/nested/style.sass" + "node_modules/sass-style-field/nested/style.sass", ); const pathToSCSSMainField = path.resolve( testFolder, - "node_modules/scss-main-field/nested/style.scss" + "node_modules/scss-main-field/nested/style.scss", ); const pathToSassMainField = path.resolve( testFolder, - "node_modules/sass-main-field/nested/style.sass" + "node_modules/sass-main-field/nested/style.sass", ); const pathToSCSSAlias = path.resolve( testFolder, - "scss/directory-6/file/_index.scss" + "scss/directory-6/file/_index.scss", ); const pathToSassAlias = path.resolve( testFolder, - "sass/directory-6/file/_index.sass" + "sass/directory-6/file/_index.sass", ); const pathToSCSSIndexAlias = path.resolve( testFolder, - "scss/dir-with-underscore-index/_index.scss" + "scss/dir-with-underscore-index/_index.scss", ); const pathToSassIndexAlias = path.resolve( testFolder, - "sass/dir-with-underscore-index/_index.sass" + "sass/dir-with-underscore-index/_index.sass", ); const pathToScopedNpmPkg = path.resolve( testFolder, - "node_modules/@org/pkg/index.scss" + "node_modules/@org/pkg/index.scss", ); const pathToScopedNpmFile = path.resolve( testFolder, - "node_modules/@org/style.scss" + "node_modules/@org/style.scss", ); const pathToSCSSCustomSassField = path.resolve( testFolder, - "node_modules/scss-custom-sass-field/nested/style.scss" + "node_modules/scss-custom-sass-field/nested/style.scss", ); const pathToSassCustomSassField = path.resolve( testFolder, - "node_modules/sass-custom-sass-field/nested/style.sass" + "node_modules/sass-custom-sass-field/nested/style.sass", ); const pathToBootstrap3Entry = path.resolve( testFolder, - "../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss" + "../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss", ); const pathToBootstrap3Package = path.resolve( testFolder, - "../node_modules/bootstrap-sass" + "../node_modules/bootstrap-sass", ); const pathToBootstrap4Entry = path.resolve( testFolder, - "../node_modules/bootstrap-v4/scss/bootstrap.scss" + "../node_modules/bootstrap-v4/scss/bootstrap.scss", ); const pathToBootstrap5Entry = path.resolve( testFolder, - "../node_modules/bootstrap-v5/scss/bootstrap.scss" + "../node_modules/bootstrap-v5/scss/bootstrap.scss", ); const pathToModule = path.resolve( testFolder, - "node_modules/module/module.scss" + "node_modules/module/module.scss", ); const pathToAnother = path.resolve( testFolder, - "node_modules/another/module.scss" + "node_modules/another/module.scss", ); const pathToPackageWithStyleFieldAndCss = isSass ? path.resolve( testFolder, - "node_modules/package-with-style-field-and-css/sass/package-with-style-field-and-css.sass" + "node_modules/package-with-style-field-and-css/sass/package-with-style-field-and-css.sass", ) : path.resolve( testFolder, - "node_modules/package-with-style-field-and-css/scss/package-with-style-field-and-css.scss" + "node_modules/package-with-style-field-and-css/scss/package-with-style-field-and-css.scss", ); const pathToPackageWithJsAndCssMainFiles = path.resolve( testFolder, - "node_modules/package-with-js-and-css-main-files/index" + "node_modules/package-with-js-and-css-main-files/index", ); const pathToPackageWithJsMainField = path.resolve( testFolder, - "node_modules/package-with-js-main-field/index.scss" + "node_modules/package-with-js-main-field/index.scss", ); const pathToPackageWithIndex = path.resolve( testFolder, - "node_modules/package-with-index/_index.scss" + "node_modules/package-with-index/_index.scss", ); const pathToLanguage = isSass ? path.resolve(testFolder, "sass/language.sass") : path.resolve(testFolder, "scss/language.scss"); const pathToPackageWithSameImport = path.resolve( testFolder, - "node_modules/package-with-same-import/style.scss" + "node_modules/package-with-same-import/style.scss", ); const pathToMaterial = path.resolve( __dirname, - "../../node_modules/@material" + "../../node_modules/@material", ); const pathToCustomMainFiles = isSass ? path.resolve(testFolder, "sass/custom-main-files/custom.sass") @@ -731,7 +732,7 @@ async function getCodeFromSass(testId, options, context = {}) { .replace(/^path-to-alias/, pathToAlias) .replace( /^package-with-style-field-and-css/, - pathToPackageWithStyleFieldAndCss + pathToPackageWithStyleFieldAndCss, ) .replace(/^~scss-sass-field/, pathToSCSSSassField) .replace(/^~sass-sass-field/, pathToSassSassField) @@ -745,27 +746,27 @@ async function getCodeFromSass(testId, options, context = {}) { .replace(/^~@sass$/, pathToSassAlias) .replace( /^~@path-to-scss-dir\/dir-with-underscore-index$/, - pathToSCSSIndexAlias + pathToSCSSIndexAlias, ) .replace( /^~@path-to-scss-dir\/dir-with-underscore-index\/$/, - pathToSCSSIndexAlias + pathToSCSSIndexAlias, ) .replace( /^~@path-to-sass-dir\/dir-with-underscore-index$/, - pathToSassIndexAlias + pathToSassIndexAlias, ) .replace( /^~@path-to-sass-dir\/dir-with-underscore-index\/$/, - pathToSassIndexAlias + pathToSassIndexAlias, ) .replace( /^~@\/path-to-scss-dir\/dir-with-underscore-index$/, - pathToSCSSIndexAlias + pathToSCSSIndexAlias, ) .replace( /^~@\/path-to-sass-dir\/dir-with-underscore-index$/, - pathToSassIndexAlias + pathToSassIndexAlias, ) .replace(/^~@org\/pkg/, pathToScopedNpmPkg) .replace(/^@org\/style/, pathToScopedNpmFile) @@ -779,13 +780,13 @@ async function getCodeFromSass(testId, options, context = {}) { .replace(/^~another/, pathToAnother) .replace( /^~package-with-js-and-css-main-files/, - pathToPackageWithJsAndCssMainFiles + pathToPackageWithJsAndCssMainFiles, ) .replace(/^~package-with-js-main-field/, pathToPackageWithJsMainField) .replace(/^~package-with-index/, pathToPackageWithIndex) .replace( /^package-with-exports-and-custom-condition$/, - pathToSassPackageWithExportsFieldsAndCustomConditionReplacer + pathToSassPackageWithExportsFieldsAndCustomConditionReplacer, ) .replace(/^package-with-exports$/, pathToSassPackageWithExportsFields) .replace(/^file:\/\/\/language/, pathToLanguage) @@ -795,7 +796,7 @@ async function getCodeFromSass(testId, options, context = {}) { .replace(/^file:\/\/\/sass\/language.sass/, pathToLanguage) .replace( /^package-with-same-import\/style/, - pathToPackageWithSameImport + pathToPackageWithSameImport, ) .replace(/@material/, pathToMaterial) .replace(/custom-main-files/, pathToCustomMainFiles) @@ -813,7 +814,7 @@ async function getCodeFromSass(testId, options, context = {}) { .concat( Array.isArray(sassOptions.importer) ? [...sassOptions.importer] - : [sassOptions.importer] + : [sassOptions.importer], ) .concat([testImporter]) : [testImporter]; @@ -829,14 +830,10 @@ async function getCodeFromSass(testId, options, context = {}) { ({ css, sourceMap: map } = await implementation.compileStringAsync( data, - rest + rest, )); } else { ({ css, map } = await new Promise((resolve, reject) => { - if (sassOptions.fiber === false) { - delete sassOptions.fiber; - } - implementation.render(sassOptions, (error, result) => { if (error) { reject(error); diff --git a/test/helpers/getCompiler.js b/test/helpers/getCompiler.js index 8707ab5b..b95c32db 100644 --- a/test/helpers/getCompiler.js +++ b/test/helpers/getCompiler.js @@ -32,7 +32,7 @@ const output = (config) => { return { path: path.resolve( __dirname, - `../outputs/${config.output ? config.output : ""}` + `../outputs/${config.output ? config.output : ""}`, ), filename: "[name].bundle.js", library: "sassLoaderExport", diff --git a/test/helpers/normalizeErrors.js b/test/helpers/normalizeErrors.js index 248698bd..b00c19ca 100644 --- a/test/helpers/normalizeErrors.js +++ b/test/helpers/normalizeErrors.js @@ -19,6 +19,6 @@ export default (errors, needVerbose) => removeCWD( needVerbose ? error.toString() - : error.toString().split("\n").slice(0, 2).join("\n") - ) + : error.toString().split("\n").slice(0, 2).join("\n"), + ), ); diff --git a/test/implementation-option.test.js b/test/implementation-option.test.js index d699a0f1..ead83b63 100644 --- a/test/implementation-option.test.js +++ b/test/implementation-option.test.js @@ -39,7 +39,7 @@ describe("implementation option", () => { const sassEmbeddedSpy = jest.spyOn(sassEmbedded, "render"); const sassEmbeddedSpyModernAPI = jest.spyOn( sassEmbedded, - "compileStringAsync" + "compileStringAsync", ); const testId = getTestId("language", "scss"); diff --git a/test/loader.test.js b/test/loader.test.js index a5755896..a5e4abe1 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -79,7 +79,7 @@ describe("loader", () => { it(`should work ('${implementationName}', '${api}' API, '${syntax}' syntax) with the "memory" cache`, async () => { const cache = path.resolve( __dirname, - `./outputs/.cache/sass-loader/${implementationName}/${syntax}` + `./outputs/.cache/sass-loader/${implementationName}/${syntax}`, ); await del(cache); @@ -108,7 +108,7 @@ describe("loader", () => { it(`should work ('${implementationName}', '${api}' API, '${syntax}' syntax) with the "filesystem" cache`, async () => { const cache = path.resolve( __dirname, - `./outputs/.cache/sass-loader/${implementationName}/${syntax}` + `./outputs/.cache/sass-loader/${implementationName}/${syntax}`, ); await del(cache); @@ -163,8 +163,8 @@ describe("loader", () => { expect( stats.compilation.fileDependencies.has( - path.resolve(`./test/${syntax}/error.${syntax}`) - ) + path.resolve(`./test/${syntax}/error.${syntax}`), + ), ).toBe(true); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); @@ -181,13 +181,13 @@ describe("loader", () => { expect( stats.compilation.fileDependencies.has( - path.resolve(`./test/${syntax}/error-import.${syntax}`) - ) + path.resolve(`./test/${syntax}/error-import.${syntax}`), + ), ).toBe(true); expect( stats.compilation.fileDependencies.has( - path.resolve(`./test/${syntax}/error.${syntax}`) - ) + path.resolve(`./test/${syntax}/error.${syntax}`), + ), ).toBe(true); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); @@ -204,8 +204,8 @@ describe("loader", () => { expect( stats.compilation.fileDependencies.has( - path.resolve(`./test/${syntax}/error-file-not-found.${syntax}`) - ) + path.resolve(`./test/${syntax}/error-file-not-found.${syntax}`), + ), ).toBe(true); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); @@ -222,8 +222,8 @@ describe("loader", () => { expect( stats.compilation.fileDependencies.has( - path.resolve(`./test/${syntax}/error-file-not-found-2.${syntax}`) - ) + path.resolve(`./test/${syntax}/error-file-not-found-2.${syntax}`), + ), ).toBe(true); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); @@ -340,7 +340,7 @@ describe("loader", () => { it(`should work when "@import" at-rules without extensions and do not start with "_" ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( "import-without-extension-and-underscore", - syntax + syntax, ); const options = { implementation, @@ -568,7 +568,7 @@ describe("loader", () => { it(`should prefer "mainFiles" over "mainFields" when the field contains "js" file ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( "import-prefer-main-files-over-main-fields", - syntax + syntax, ); const options = { implementation, @@ -590,7 +590,7 @@ describe("loader", () => { it(`should prefer "mainFiles" with extension over without ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( "import-prefer-main-files-with-extension", - syntax + syntax, ); const options = { implementation, @@ -646,21 +646,21 @@ describe("loader", () => { __dirname, syntax, "another", - `alias.${syntax}` + `alias.${syntax}`, ), "@sass": path.resolve( __dirname, "sass", "directory-6", "file", - "_index.sass" + "_index.sass", ), "@scss": path.resolve( __dirname, "scss", "directory-6", "file", - `_index.scss` + `_index.scss`, ), "@path-to-scss-dir": path.resolve(__dirname, "scss"), "@path-to-sass-dir": path.resolve(__dirname, "sass"), @@ -838,7 +838,7 @@ describe("loader", () => { it(`should work with the "foundation-sites" package, adjusting CSS output ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( "foundation-sites-adjusting-css-output", - syntax + syntax, ); const options = { implementation, @@ -879,7 +879,7 @@ describe("loader", () => { : { outputStyle: "compressed", }, - }) + }), ); expect(codeFromBundle.css).toBe(codeFromSass.css); @@ -895,14 +895,14 @@ describe("loader", () => { ? { loadPaths: [ path.resolve( - `./test/node_modules/package-with-style-field-and-css/${syntax}` + `./test/node_modules/package-with-style-field-and-css/${syntax}`, ), ], } : { includePaths: [ path.resolve( - `./test/node_modules/package-with-style-field-and-css/${syntax}` + `./test/node_modules/package-with-style-field-and-css/${syntax}`, ), ], }, @@ -924,7 +924,7 @@ describe("loader", () => { it(`should load only sass/scss files for the "mainFiles" ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( "import-package-with-js-and-css-main-files", - syntax + syntax, ); const options = { implementation, @@ -966,12 +966,12 @@ describe("loader", () => { ? `${path.resolve("test", syntax, "sass_path")};${path.resolve( "test", syntax, - "sass_path_other" + "sass_path_other", )}` : `${path.resolve("test", syntax, "sass_path")}:${path.resolve( "test", syntax, - "sass_path_other" + "sass_path_other", )}`; const testId = getTestId("sass_path-env", syntax); @@ -1016,7 +1016,7 @@ describe("loader", () => { it(`should respect resolving directory with the "index" file from "process.cwd()" ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( "process-cwd-with-index-file-inside-directory", - syntax + syntax, ); const options = { implementation, @@ -1057,7 +1057,7 @@ describe("loader", () => { it(`should work with a package with "sass" and "exports" fields and a custom condition (theme1) ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( "import-package-with-exports-and-custom-condition", - syntax + syntax, ); const options = { implementation, @@ -1086,7 +1086,7 @@ describe("loader", () => { it(`should work with a package with "sass" and "exports" fields and a custom condition (theme2) ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( "import-package-with-exports-and-custom-condition", - syntax + syntax, ); const options = { implementation, @@ -1125,7 +1125,7 @@ describe("loader", () => { "/language": path.resolve( "./test", syntax, - `language.${syntax}` + `language.${syntax}`, ), }, }, @@ -1172,13 +1172,13 @@ describe("loader", () => { /\/scss\/language.scss/g, `file:///${path .resolve(__dirname, "scss/language.scss") - .replace(/\\/g, "/")}` + .replace(/\\/g, "/")}`, ) .replace( /\/sass\/language.sass/g, `file:///${path .resolve(__dirname, "sass/language.sass") - .replace(/\\/g, "/")}` + .replace(/\\/g, "/")}`, ), }; const compiler = getCompiler(testId, { loader: { options } }); @@ -1333,13 +1333,13 @@ describe("loader", () => { expect( stats.compilation.fileDependencies.has( - path.resolve(`./test/${syntax}/error-use.${syntax}`) - ) + path.resolve(`./test/${syntax}/error-use.${syntax}`), + ), ).toBe(true); expect( stats.compilation.fileDependencies.has( - path.resolve(`./test/${syntax}/error.${syntax}`) - ) + path.resolve(`./test/${syntax}/error.${syntax}`), + ), ).toBe(true); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); @@ -1357,9 +1357,9 @@ describe("loader", () => { expect( stats.compilation.fileDependencies.has( path.resolve( - `./test/${syntax}/error-file-not-found-use.${syntax}` - ) - ) + `./test/${syntax}/error-file-not-found-use.${syntax}`, + ), + ), ).toBe(true); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); @@ -1377,9 +1377,9 @@ describe("loader", () => { expect( stats.compilation.fileDependencies.has( path.resolve( - `./test/${syntax}/error-file-not-found-use-2.${syntax}` - ) - ) + `./test/${syntax}/error-file-not-found-use-2.${syntax}`, + ), + ), ).toBe(true); expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); @@ -1477,7 +1477,7 @@ describe("loader", () => { it(`should work when "@use" at-rules without extensions and do not start with "_" ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( "use-without-extension-and-underscore", - syntax + syntax, ); const options = { implementation, @@ -1711,21 +1711,21 @@ describe("loader", () => { __dirname, syntax, "another", - `alias.${syntax}` + `alias.${syntax}`, ), "@sass": path.resolve( __dirname, "sass", "directory-6", "file", - "_index.sass" + "_index.sass", ), "@scss": path.resolve( __dirname, "scss", "directory-6", "file", - `_index.scss` + `_index.scss`, ), "@path-to-scss-dir": path.resolve(__dirname, "scss"), "@path-to-sass-dir": path.resolve(__dirname, "sass"), @@ -1981,7 +1981,7 @@ describe("loader", () => { it(`should import .import.${syntax} files from a package ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( "import-index-import-from-package", - syntax + syntax, ); const options = { implementation, @@ -2080,10 +2080,10 @@ describe("loader", () => { args: i.args.map((arg) => arg .replace(url.pathToFileURL(__dirname), "file:///") - .replace(/\\/g, "/") + .replace(/\\/g, "/"), ), }; - }) + }), ); } } diff --git a/test/manual/index.html b/test/manual/index.html index 5488c3c7..92ad64d2 100644 --- a/test/manual/index.html +++ b/test/manual/index.html @@ -1,4 +1,4 @@ - + diff --git a/test/resolver.test.js b/test/resolver.test.js index c399aeb4..2cd98ae6 100644 --- a/test/resolver.test.js +++ b/test/resolver.test.js @@ -20,7 +20,7 @@ describe("getWebpackResolver", () => { it("should resolve from passed `includePaths`", async () => { expect(await resolve("empty", [`${__dirname}/scss`])).toMatch( - /empty\.scss$/ + /empty\.scss$/, ); }); diff --git a/test/sassOptions-option.test.js b/test/sassOptions-option.test.js index aa3dc1f6..5ca7de28 100644 --- a/test/sassOptions-option.test.js +++ b/test/sassOptions-option.test.js @@ -1,8 +1,6 @@ import path from "path"; import globImporter from "node-sass-glob-importer"; -import semver from "semver"; -import dartSass from "sass"; import { compile, @@ -212,7 +210,7 @@ describe("sassOptions option", () => { it(`should work with the "functions" option ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId( api === "modern" ? "custom-functions-modern" : "custom-functions", - syntax + syntax, ); const options = { implementation, @@ -437,36 +435,6 @@ describe("sassOptions option", () => { }); } - if (!isModernAPI) { - it(`should don't use the "fibers" package when the "fiber" option is "false" ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { - const dartSassSpy = jest.spyOn(dartSass, "render"); - const testId = getTestId("language", syntax); - const options = { - implementation, - api, - sassOptions: { fiber: false }, - }; - const compiler = getCompiler(testId, { loader: { options } }); - const stats = await compile(compiler); - const codeFromBundle = getCodeFromBundle(stats, compiler); - const codeFromSass = await getCodeFromSass(testId, options); - - if ( - implementationName === "dart-sass" && - semver.satisfies(process.version, ">= 10") - ) { - expect(dartSassSpy.mock.calls[0][0]).not.toHaveProperty("fiber"); - } - - expect(codeFromBundle.css).toBe(codeFromSass.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); - - dartSassSpy.mockRestore(); - }); - } - it(`should respect the "outputStyle"/"style" option ('${implementationName}', '${api}' API, '${syntax}' syntax)`, async () => { const testId = getTestId("language", syntax); const options = { diff --git a/test/sourceMap-options.test.js b/test/sourceMap-options.test.js index 468fe160..7453d56c 100644 --- a/test/sourceMap-options.test.js +++ b/test/sourceMap-options.test.js @@ -37,7 +37,7 @@ describe("sourceMap option", () => { expect(path.isAbsolute(source)).toBe(true); expect(source).toBe(path.normalize(source)); expect( - fs.existsSync(path.resolve(sourceMap.sourceRoot, source)) + fs.existsSync(path.resolve(sourceMap.sourceRoot, source)), ).toBe(true); return path @@ -68,7 +68,7 @@ describe("sourceMap option", () => { expect(path.isAbsolute(source)).toBe(true); expect(source).toBe(path.normalize(source)); expect( - fs.existsSync(path.resolve(sourceMap.sourceRoot, source)) + fs.existsSync(path.resolve(sourceMap.sourceRoot, source)), ).toBe(true); return path @@ -99,7 +99,7 @@ describe("sourceMap option", () => { expect(path.isAbsolute(source)).toBe(true); expect(source).toBe(path.normalize(source)); expect( - fs.existsSync(path.resolve(sourceMap.sourceRoot, source)) + fs.existsSync(path.resolve(sourceMap.sourceRoot, source)), ).toBe(true); return path @@ -157,8 +157,8 @@ describe("sourceMap option", () => { expect( fs.existsSync( - path.resolve(__dirname, path.normalize(normalizedSource)) - ) + path.resolve(__dirname, path.normalize(normalizedSource)), + ), ).toBe(true); return path diff --git a/test/warnRuleAsWarning.test.js b/test/warnRuleAsWarning.test.js index 0623463a..6f758d12 100644 --- a/test/warnRuleAsWarning.test.js +++ b/test/warnRuleAsWarning.test.js @@ -42,10 +42,10 @@ describe("loader", () => { args: i.args.map((arg) => arg .replace(url.pathToFileURL(__dirname), "file:///") - .replace(/\\/g, "/") + .replace(/\\/g, "/"), ), }; - }) + }), ); } } @@ -79,10 +79,10 @@ describe("loader", () => { args: i.args.map((arg) => arg .replace(url.pathToFileURL(__dirname), "file:///") - .replace(/\\/g, "/") + .replace(/\\/g, "/"), ), }; - }) + }), ); } } @@ -116,10 +116,10 @@ describe("loader", () => { args: i.args.map((arg) => arg .replace(url.pathToFileURL(__dirname), "file:///") - .replace(/\\/g, "/") + .replace(/\\/g, "/"), ), }; - }) + }), ); } } @@ -152,10 +152,10 @@ describe("loader", () => { args: i.args.map((arg) => arg .replace(url.pathToFileURL(__dirname), "file:///") - .replace(/\\/g, "/") + .replace(/\\/g, "/"), ), }; - }) + }), ); } }