Skip to content

Commit 6205bcc

Browse files
committed
Revert multiple compilation stats per patch, has incorrect baseline that doesnt match actual behavior
This reverts commit 9d62b44.
1 parent 399b60a commit 6205bcc

File tree

13 files changed

+26
-300
lines changed

13 files changed

+26
-300
lines changed

test/comparison-tests/create-and-execute-test.js

+17-42
Original file line numberDiff line numberDiff line change
@@ -169,38 +169,21 @@ function createWebpackConfig(paths, optionsOriginal, useWatchApi) {
169169
}
170170

171171
function createWebpackWatchHandler(done, paths, testState, options, test) {
172-
let timoutId;
173-
let statsString;
174-
let errString;
175172
return function (err, stats) {
176-
if (timoutId) {
177-
clearTimeout(timoutId);
178-
timoutId = undefined;
179-
}
180173
const patch = setPathsAndGetPatch(paths, testState, options);
181-
const currentErrString = errToString(err, paths);
182-
if (currentErrString) {
183-
errString = errString ? errString + "\n\n" + currentErrString : currentErrString;
184-
}
185-
const currentStatsString = statsToString(stats, testState, paths);
186-
if (currentStatsString) {
187-
statsString = statsString ? statsString + "\n\n" + currentStatsString : currentStatsString;
188-
}
189-
timoutId = setTimeout(function () {
190-
cleanHashFromOutput(stats, paths.webpackOutput);
191174

192-
copySync(paths.webpackOutput, paths.actualOutput);
193-
rimraf.sync(paths.webpackOutput);
175+
cleanHashFromOutput(stats, paths.webpackOutput);
176+
177+
copySync(paths.webpackOutput, paths.actualOutput);
178+
rimraf.sync(paths.webpackOutput);
179+
180+
handleErrors(err, paths);
194181

195-
handleErrors(errString, paths);
196-
errString = undefined;
182+
storeStats(stats, testState, paths);
197183

198-
storeStats(statsString, paths);
199-
statsString = undefined;
184+
compareFiles(paths, test, patch);
200185

201-
compareFiles(paths, test, patch);
202-
copyPatchOrEndTest(paths.testStagingPath, testState.watcher, testState, done);
203-
}, 2000);
186+
copyPatchOrEndTest(paths.testStagingPath, testState.watcher, testState, done);
204187
}
205188
}
206189

@@ -219,35 +202,26 @@ function setPathsAndGetPatch(paths, testState, options) {
219202
return patch;
220203
}
221204

222-
function handleErrors(errString, paths) {
223-
if (errString) {
205+
function handleErrors(err, paths) {
206+
if (err) {
224207
const errFileName = 'err.txt';
225-
fs.writeFileSync(path.join(paths.actualOutput, errFileName), errString);
226-
}
227-
}
228208

229-
function errToString(err, paths) {
230-
if (err) {
231209
const errString = err.toString()
232210
.replace(new RegExp(regexEscape(paths.testStagingPath + path.sep), 'g'), '')
233211
.replace(new RegExp(regexEscape(rootPath + path.sep), 'g'), '')
234212
.replace(new RegExp(regexEscape(rootPath), 'g'), '')
235213
.replace(/\.transpile/g, '');
236-
return errString;
237-
}
238-
}
239214

240-
function storeStats(statsString, paths) {
241-
if (statsString) {
242-
const statsFileName = 'output.txt';
243-
fs.writeFileSync(path.join(paths.actualOutput, statsFileName), statsString);
215+
fs.writeFileSync(path.join(paths.actualOutput, errFileName), errString);
244216
}
245217
}
246218

247-
function statsToString(stats, testState, paths) {
219+
function storeStats(stats, testState, paths) {
248220
if (stats && stats.hash !== testState.lastHash) {
249221
testState.lastHash = stats.hash;
250222

223+
const statsFileName = 'output.txt';
224+
251225
// do a little magic to normalize `\` to `/` for asset output
252226
const newAssets = {};
253227
Object.keys(stats.compilation.assets).forEach(function (asset) {
@@ -262,7 +236,8 @@ function statsToString(stats, testState, paths) {
262236
.replace(new RegExp(regexEscape(rootPath), 'g'), '')
263237
.replace(new RegExp(regexEscape(rootPathWithIncorrectWindowsSeparator), 'g'), '')
264238
.replace(/\.transpile/g, '');
265-
return statsString;
239+
240+
fs.writeFileSync(path.join(paths.actualOutput, statsFileName), statsString);
266241
}
267242
}
268243

test/comparison-tests/projectReferencesOutDirWithPackageJsonAlreadyBuilt/expectedOutput-3.8/patch0/bundle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ eval("\nexports.__esModule = true;\nvar lib_1 = __webpack_require__(/*! ./lib */
106106
/***/ (function(module, exports, __webpack_require__) {
107107

108108
"use strict";
109-
eval("\nexports.__esModule = true;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3,\n four: 4 // Add new number\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack:///./lib/out/index.js?");
109+
eval("\nexports.__esModule = true;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack:///./lib/out/index.js?");
110110

111111
/***/ })
112112

test/comparison-tests/projectReferencesOutDirWithPackageJsonAlreadyBuilt/expectedOutput-3.8/patch0/output.txt

+1-7
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,4 @@
66
../lib/out/tsconfig.tsbuildinfo 70 KiB [emitted]
77
Entrypoint main = bundle.js
88
[./app.ts] 131 bytes {main} [built]
9-
[./lib/out/index.js] 130 bytes {main}
10-
11-
Asset Size Chunks Chunk Names
12-
bundle.js 4.37 KiB main [emitted] main
13-
Entrypoint main = bundle.js
14-
[./app.ts] 131 bytes {main}
15-
[./lib/out/index.js] 161 bytes {main} [built]
9+
[./lib/out/index.js] 130 bytes {main}

test/comparison-tests/projectReferencesOutDirWithPackageJsonAlreadyBuilt/expectedOutput-3.8/patch1/output.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
bundle.js 4.4 KiB main [emitted] main
33
Entrypoint main = bundle.js
44
[./app.ts] 169 bytes {main} [built]
5-
[./lib/out/index.js] 161 bytes {main}
5+
[./lib/out/index.js] 161 bytes {main} [built]

test/comparison-tests/projectReferencesOutDirWithPackageJsonAlreadyBuilt/expectedOutput-3.8/patch3/bundle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ eval("\nexports.__esModule = true;\nvar lib_1 = __webpack_require__(/*! ./lib */
106106
/***/ (function(module, exports, __webpack_require__) {
107107

108108
"use strict";
109-
eval("\nexports.__esModule = true;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3,\n four: 4,\n five: 5\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack:///./lib/out/index.js?");
109+
eval("\nexports.__esModule = true;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3,\n four: 4 // Add new number\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack:///./lib/out/index.js?");
110110

111111
/***/ })
112112

test/comparison-tests/projectReferencesOutDirWithPackageJsonAlreadyBuilt/expectedOutput-3.8/patch3/output.txt

+1-7
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,4 @@
66
../lib/out/tsconfig.tsbuildinfo 70 KiB [emitted]
77
Entrypoint main = bundle.js
88
[./app.ts] 169 bytes {main} [built]
9-
[./lib/out/index.js] 161 bytes {main}
10-
11-
Asset Size Chunks Chunk Names
12-
bundle.js 4.4 KiB main [emitted] main
13-
Entrypoint main = bundle.js
14-
[./app.ts] 169 bytes {main}
15-
[./lib/out/index.js] 156 bytes {main} [built]
9+
[./lib/out/index.js] 161 bytes {main}

test/comparison-tests/projectReferencesOutDirWithPackageJsonAlreadyBuilt/expectedOutput-3.8/patch4/output.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
bundle.js 4.42 KiB main [emitted] main
33
Entrypoint main = bundle.js
44
[./app.ts] 186 bytes {main} [built] [1 error]
5-
[./lib/out/index.js] 156 bytes {main}
5+
[./lib/out/index.js] 156 bytes {main} [built]
66

77
ERROR in app.ts
88
./app.ts

test/comparison-tests/projectReferencesOutDirWithPackageJsonAlreadyBuilt/expectedOutput-transpile-3.8/patch0/bundle.js

-113
This file was deleted.

test/comparison-tests/projectReferencesOutDirWithPackageJsonAlreadyBuilt/expectedOutput-transpile-3.8/patch0/output.txt

-5
This file was deleted.

test/comparison-tests/projectReferencesOutDirWithPackageJsonAlreadyBuilt/expectedOutput-transpile-3.8/patch1/output.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
bundle.js 4.44 KiB main [emitted] main
33
Entrypoint main = bundle.js
44
[./app.ts] 205 bytes {main} [built]
5-
[./lib/out/index.js] 161 bytes {main}
5+
[./lib/out/index.js] 161 bytes {main} [built]

0 commit comments

Comments
 (0)