Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Dec 20, 2019
1 parent cb63d8e commit 53d255a
Show file tree
Hide file tree
Showing 12 changed files with 331 additions and 784 deletions.
1,049 changes: 270 additions & 779 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"standard-version": "^7.0.1",
"webpack": "^4.41.3",
"webpack": "next",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.7.2"
},
Expand Down
23 changes: 19 additions & 4 deletions test/TestCases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ function compareDirectory(actual, expected) {
}

function compareWarning(actual, expectedFile) {
if (!fs.existsSync(expectedFile)) return;
if (!fs.existsSync(expectedFile)) {
return;
}

// eslint-disable-next-line global-require, import/no-dynamic-require
const expected = require(expectedFile);

const expected = require(expectedFile); // eslint-disable-line global-require,import/no-dynamic-require
expect(actual).toBe(expected);
expect(actual.trim()).toBe(expected.trim());
}

describe('TestCases', () => {
Expand Down Expand Up @@ -97,8 +101,19 @@ describe('TestCases', () => {
}

const expectedDirectory = path.resolve(directoryForCase, 'expected');
const expectedDirectoryByVersion = path.join(
expectedDirectory,
`webpack-${webpack.version[0]}`
);

compareDirectory(outputDirectoryForCase, expectedDirectory);
if (fs.existsSync(expectedDirectoryByVersion)) {
compareDirectory(
outputDirectoryForCase,
expectedDirectoryByVersion
);
} else {
compareDirectory(outputDirectoryForCase, expectedDirectory);
}

const expectedWarning = path.resolve(directoryForCase, 'warnings.js');
const actualWarning = stats.toString({
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions test/cases/composes-async/expected/webpack-5/1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.base {
background: blue;
}

4 changes: 4 additions & 0 deletions test/cases/composes-async/expected/webpack-5/2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.base {
background: blue;
}

2 changes: 2 additions & 0 deletions test/cases/composes-async/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Self from '../../../src';

// TODO buggy in webpack@5

module.exports = {
entry: './index.js',
module: {
Expand Down
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions test/cases/hmr/expected/webpack-5/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@import url(https://some/other/external/css);
@import url(https://some/external/css);
body {
background: red;
}

.c {
background: red;
}

.c {
color: yellow;
}

.b {
background: red;
}

.b {
color: yellow;
}



7 changes: 7 additions & 0 deletions test/cases/hmr/expected/webpack-5/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/******/ (() => { // webpackBootstrap
/******/ /************************************************************************/
// extracted by mini-css-extract-plugin
if(false) { var cssReload; }

/******/ })()
;

0 comments on commit 53d255a

Please sign in to comment.