Skip to content

Conversation

cristiand391
Copy link
Member

@cristiand391 cristiand391 commented Aug 18, 2025

What does this PR do?

Fixes issues blocking tests from being run in node v24:

  • replace deprecated node fs prop
  • bump mocha to get ts loader fix
  • bump dev-scripts to get right node types

@W-19160014@

@@ -23,7 +23,7 @@ const registriesFromPresets = fs
.filter((file) => !file.name.endsWith('CustomLabelsBeta.json'))
.map((file) => ({
name: file.name,
registry: JSON.parse(fs.readFileSync(path.join(file.path, file.name), 'utf-8')) as MetadataRegistry,
registry: JSON.parse(fs.readFileSync(path.join(file.parentPath, file.name), 'utf-8')) as MetadataRegistry,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous path prop was deprecated in node v18,20 and 21 then removed in v24:
https://nodejs.org/docs/latest-v22.x/api/fs.html#direntpath

parentPath is supported on node >= 18.20.0 so it's safe to use

@@ -1,4 +1,5 @@
{
"devDepOverrides": ["mocha"],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mocha v10 has a bug when loading TS files via a node loader:
mochajs/mocha#5314

after fixing the types in SDR we still get those wrong warnings:
Image

this change overrides the version of mocha provided by dev-scripts so we can use mocha v11 here, see:
https://github.com/forcedotcom/dev-scripts/?tab=readme-ov-file#config-file-notes

related:
oclif/core#1416

@@ -209,5 +210,8 @@
},
"publishConfig": {
"access": "public"
},
"resolutions": {
"@types/node": "18.19.123"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we bumped these types in dev-script: forcedotcom/dev-scripts#388

but there's another @types/node for node v20 coming as a peerDep from commitlint deps, we'll override it here as a workaround until we drop node v18.

@cristiand391 cristiand391 marked this pull request as ready for review August 18, 2025 18:31
@cristiand391 cristiand391 requested a review from a team as a code owner August 18, 2025 18:31
@soridalac soridalac merged commit 25ad04e into main Aug 18, 2025
50 checks passed
@soridalac soridalac deleted the cd/deprecated-prop branch August 18, 2025 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants