-
Notifications
You must be signed in to change notification settings - Fork 215
Update NodeJS to v20 #4264
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
base: develop
Are you sure you want to change the base?
Update NodeJS to v20 #4264
Conversation
@@ -1,2 +1,5 @@ | |||
legacy-peer-deps=true | |||
engine-strict=true | |||
save-exact = true |
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.
Config copied from Guteberg
module.exports = { | ||
...require( '@wordpress/prettier-config' ), | ||
overrides: [ | ||
{ | ||
files: [ 'changelog.txt' ], | ||
options: { parser: 'markdown' }, | ||
}, | ||
], | ||
}; |
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.
Config copied from Guteberg
@@ -89,7 +89,7 @@ function load_js_transpiling_source_maps(): array { | |||
} | |||
|
|||
foreach ( $file_json[ 'sources' ] as $source ) { | |||
$source = preg_replace( '%^webpack:///\./(client/.*)$%', '${1}', $source ); | |||
$source = preg_replace( '%^webpack://\./(client/.*)$%', '${1}', $source ); |
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.
In the Webpack 5 config, we are manually setting devtoolModuleFilenameTemplate
, so we can replace the previous triple slash prefixes with normal URL-like paths webpack://[resource-path]
'@wordpress/i18n-text-domain': [ | ||
'error', | ||
{ | ||
allowedTextDomain: 'woocommerce-gateway-stripe', | ||
}, | ||
], |
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.
@wordpress/i18n-text-domain
was reporting a lot of issues. I chose to specify our expected text domain, but we could also keep to the defaults.
@@ -82,4 +88,5 @@ module.exports = { | |||
'@wordpress/data', | |||
], | |||
}, | |||
ignorePatterns: [ 'phpunit-html/**' ], |
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.
I tripped over a local folder left over from testing and realised it should always be ignored for linting.
ProgressLintingLinting is now working, but there are still 13 errors stemming from the following:
Javascript Unit TestsMany JS tests are not even running, mostly due to one of the following three errors:
For the first two errors, the root cause seems to be an issue relating to the interplay between The final error stems from an import of There are then a handful of what look like legitimate test failures. At least some are related to code trying to test async or delayed loading. SASS warningsIt looks like we would be able to avoid some of these by updating |
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.
Also, before I forget to note this, we almost certainly need to look at extracting some of these changes into smaller PRs that we can test and merge independently. Based on the work I did, I can think of a few areas that might qualify for this:
- Switch from
@import
to@use
in the SCSS files - Re-order some SCSS that was split by nested rules
- Re-order some JS files to ensure that code is defined before it is used
- Moving some dependencies to devDependencies (though they would still need to get their version bumped separately)
- Remove some unnecessary React hook deps
- There are a lot of linting changes that might be ignored/accepted by the older linter - if we can extract some of these out, this patch will be much more manageable
@@ -1,2 +1,5 @@ | |||
legacy-peer-deps=true | |||
engine-strict=true | |||
save-exact = true |
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.
While working on various dependencies, I noticed that this results in the default ^
prefix for compatible versions being removed. I am not sure how I feel about that, but I wanted to flag it as a key side-effect.
engine-strict=true | ||
save-exact = true | ||
engine-strict = true | ||
legacy-peer-deps = true |
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.
Do we still need this? Maybe something for a follow-up PR.
…to handle their own mocking
Pushed up my changes which don't resolve the jest issue but nudge things in the right direction. Individual tests are still handling too much of their own mocking which is causing a lot of headaches. The mocks setup needs to be rethought entirely and shift as much as possible to handling with global mocks and overrides in the test files only when absolutely necessary. I also experimented with a |
let data = normalizeOrderData( sourceEvent, paymentRequestType ); | ||
data = getRequiredFieldDataFromCheckoutForm( data ); | ||
|
||
return $.ajax( { |
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.
I haven't looked to see how this gets utilized but I don't love that we return a promise with no default error state. It forces every instance of createOrder to implement an error catch since there is no fallback.
📈 PHP Unit Code Coverage Report
|
Fixes STRIPE-<linear_issue_id>
Fixes #<github_issue_id>
Changes proposed in this Pull Request:
This PR updates NodeJS from version v16 to v20.
Testing instructions
Changelog entry
Changelog Entry Comment
Comment
Post merge