Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: sass-loader next #1177

Merged
merged 3 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
testEnvironment: 'node',
};
262 changes: 130 additions & 132 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@
"eslint-plugin-import": "^2.22.0",
"file-loader": "^6.0.0",
"husky": "^4.2.5",
"jest": "^26.1.0",
"jest": "^26.4.2",
"less-loader": "^6.2.0",
"lint-staged": "^10.2.11",
"memfs": "^3.2.0",
"mini-css-extract-plugin": "^0.10.0",
"npm-run-all": "^4.1.5",
"postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.7.0",
"prettier": "^2.0.5",
"prettier": "^2.1.0",
"sass": "^1.26.10",
"sass-loader": "^9.0.2",
"sass-loader": "^10.0.0-rc.0",
"standard-version": "^9.0.0",
"strip-ansi": "^6.0.0",
"style-loader": "^1.2.1",
Expand Down
47 changes: 47 additions & 0 deletions test/__snapshots__/sourceMap-option.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,53 @@ a {

exports[`"sourceMap" option true should generate source maps when previous loader generates source maps ("postcss-loader"): warnings 1`] = `Array []`;

exports[`"sourceMap" option true should generate source maps when previous loader generates source maps ("sass-loader"): errors 1`] = `Array []`;

exports[`"sourceMap" option true should generate source maps when previous loader generates source maps ("sass-loader"): module 1`] = `
"// Imports
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(true);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAJc;AAEhB\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
`;

exports[`"sourceMap" option true should generate source maps when previous loader generates source maps ("sass-loader"): result 1`] = `
Array [
Array [
"./source-map/basic.scss",
"body {
font: 100% Helvetica, sans-serif;
color: #333;
}",
"",
Object {
"mappings": "AAGA;EACE,gCAAA;EACA,WAJc;AAEhB",
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/basic.scss",
],
"sourcesContent": Array [
"$font-stack: Helvetica, sans-serif;
$primary-color: #333;

body {
font: 100% $font-stack;
color: $primary-color;
}
",
],
"version": 3,
},
],
]
`;

exports[`"sourceMap" option true should generate source maps when previous loader generates source maps ("sass-loader"): warnings 1`] = `Array []`;

exports[`"sourceMap" option true should generate source maps when previous loader generates source maps ("stylus-loader"): errors 1`] = `Array []`;

exports[`"sourceMap" option true should generate source maps when previous loader generates source maps ("stylus-loader"): module 1`] = `
Expand Down
4 changes: 4 additions & 0 deletions test/esModule-option.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import path from 'path';

import MiniCssExtractPlugin from 'mini-css-extract-plugin';
Expand Down
4 changes: 4 additions & 0 deletions test/runtime/api.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

const api = require('../../src/runtime/api');

describe('api', () => {
Expand Down
4 changes: 4 additions & 0 deletions test/runtime/getUrl.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

const getUrl = require('../../src/runtime/getUrl');

describe('escape', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/sourceMap-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ describe('"sourceMap" option', () => {
expect(getErrors(stats)).toMatchSnapshot('errors');
});

it.skip('should generate source maps when previous loader generates source maps ("sass-loader")', async () => {
it('should generate source maps when previous loader generates source maps ("sass-loader")', async () => {
const compiler = getCompiler(
'./source-map/basic-scss.js',
{},
Expand Down