Skip to content

Commit

Permalink
Fix comparison tests under WSL (#1109)
Browse files Browse the repository at this point in the history
* Ensure a separate webpack instance is created if different loader options are used
Add execution test for this behaviour

* Fix import order (lint error)

* Update version to 7.04 and include in changelog

* Tweak to Changelog

* Add a delay before starting the comparison tests

* Update pull request number in changelog

* Add comments to link to pull request

Co-authored-by: John Reilly <johnny_reilly@hotmail.com>
  • Loading branch information
appzuka and johnnyreilly committed May 27, 2020
1 parent 466d067 commit 8b7c8ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,6 +1,7 @@
# Changelog

## v7.0.5
* [Add a delay before starting the comparison tests to avoid failures under WSL](https://github.com/TypeStrong/ts-loader/pull/1109) - thanks @appzuka
* [Apply other loaders when updating files in watch mode](https://github.com/TypeStrong/ts-loader/pull/1115) - thanks @iorate

## v7.0.4
Expand Down
15 changes: 11 additions & 4 deletions test/comparison-tests/create-and-execute-test.js
Expand Up @@ -109,10 +109,16 @@ function createTest(test, testPath, options) {
mkdirp.sync(paths.actualOutput);
mkdirp.sync(paths.webpackOutput);

// execute webpack
testState.watcher = webpack(
createWebpackConfig(paths, options, nonWatchNonCompositePath !== testPath)
).watch({ aggregateTimeout: 1500 }, createWebpackWatchHandler(done, paths, testState, options, test));

// Need to wait > FS_ACCURACY as defined in watchpack.
// See PR 1109 for details: https://github.com/TypeStrong/ts-loader/pull/1109
setTimeout(() => {
// execute webpack
testState.watcher = webpack(
createWebpackConfig(paths, options, nonWatchNonCompositePath !== testPath)
).watch({ aggregateTimeout: 1500 }, createWebpackWatchHandler(done, paths, testState, options, test));
}, 200);

};
}

Expand Down Expand Up @@ -275,6 +281,7 @@ function copyPatchOrEndTest(testStagingPath, watcher, testState, done) {
if (fs.existsSync(patchPath)) {
testState.iteration++;
// can get inconsistent results if copying right away
// Probably due to the reaons in PR 1109: https://github.com/TypeStrong/ts-loader/pull/1109
setTimeout(function () {
copySync(patchPath, testStagingPath);
}, 1000);
Expand Down

0 comments on commit 8b7c8ed

Please sign in to comment.