-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(webpack-preprocessor): hanging issues with webpack 5 (#15611)
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com> Co-authored-by: Chris Breiding <chrisbreiding@gmail.com>
- Loading branch information
1 parent
fafc7b0
commit 56bcbb6
Showing
6 changed files
with
154 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const execa = require('execa') | ||
const pkg = require('./package.json') | ||
const fs = require('fs') | ||
|
||
/** | ||
* This file installs Webpack 5 and runs the unit and e2e tests for the preprocessor. | ||
* We read package.json, update the webpack version, then re-run yarn install. | ||
* After it finishes, pass or fail, | ||
* we revert the package.json back to the original state. | ||
* | ||
* The tests for the example projects (inside of examples) run with Webpack 4. | ||
* This ensures we have some coverage for both versions. | ||
*/ | ||
const main = async () => { | ||
const originalPkg = JSON.stringify(pkg, null, 2) | ||
|
||
const resetPkg = async () => { | ||
fs.writeFileSync('package.json', originalPkg, 'utf8') | ||
await execa('yarn', ['install'], { stdio: 'inherit' }) | ||
} | ||
|
||
const checkExit = async ({ exitCode, step }) => { | ||
if (typeof exitCode !== 'number') { | ||
// eslint-disable-next-line no-console | ||
console.error(`${step} finished with missing exit code from execa (received ${exitCode})`) | ||
} | ||
|
||
if (step === 'e2e' || (step === 'unit' && exitCode !== 0)) { | ||
await resetPkg() | ||
process.exit(exitCode) | ||
} | ||
} | ||
|
||
pkg.dependencies['webpack'] = '^5.39.0' | ||
delete pkg.devDependencies['@types/webpack'] | ||
delete pkg.devDependencies['webpack'] | ||
// eslint-disable-next-line no-console | ||
console.log('[@cypress/webpack-preprocessor]: updating package.json...') | ||
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2)) | ||
|
||
// eslint-disable-next-line no-console | ||
console.log('[@cypress/webpack-preprocessor]: install dependencies...') | ||
await execa('yarn', ['install'], { stdio: 'inherit' }) | ||
|
||
const unit = await execa('yarn', ['test-unit'], { stdio: 'inherit' }) | ||
|
||
await checkExit({ exitCode: unit.exitCode, step: 'unit' }) | ||
|
||
const e2e = await execa('yarn', ['test-e2e'], { stdio: 'inherit' }) | ||
|
||
await checkExit({ exitCode: e2e.exitCode, step: 'e2e' }) | ||
} | ||
|
||
// execute main function if called from command line | ||
if (require.main === module) { | ||
main() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
56bcbb6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
56bcbb6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppVeyor has built the
win32 ia32
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
56bcbb6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppVeyor has built the
win32 x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally: