Skip to content

Commit 8d0aee0

Browse files
authored
fix: wrap the tsx loader path in quotes (#32400)
* fix: allow for spaces to be present in the tsx loader path so node can discover the loader. We do this by wrapping the path in quotes * chore: add rimraf to fix contributors on windows when cleaning the stderr-filtering package
1 parent 21be37e commit 8d0aee0

File tree

6 files changed

+54
-16
lines changed

6 files changed

+54
-16
lines changed

.circleci/workflows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ windowsWorkflowFilters: &windows-workflow-filters
8383
- equal: [ develop, << pipeline.git.branch >> ]
8484
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
8585
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
86-
- equal: [ 'fix/set_fixed_gtk_version', << pipeline.git.branch >> ]
86+
- equal: [ 'bugfix/tsx_loader_path', << pipeline.git.branch >> ]
8787
- matches:
8888
pattern: /^release\/\d+\.\d+\.\d+$/
8989
value: << pipeline.git.branch >>
@@ -157,7 +157,7 @@ commands:
157157
name: Set environment variable to determine whether or not to persist artifacts
158158
command: |
159159
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
160-
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "fix/set_fixed_gtk_version" ]]; then
160+
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "bugfix/tsx_loader_path" ]]; then
161161
export SHOULD_PERSIST_ARTIFACTS=true
162162
fi' >> "$BASH_ENV"
163163
# You must run `setup_should_persist_artifacts` command and be using bash before running this command

cli/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ _Released 08/26/2025 (PENDING)_
1313
- Fixed an issue where Cypress would fail to run on GNOME if GTK 4 and GTK 2/3 were detected in the Electron process. Addresses [#32361](https://github.com/cypress-io/cypress/issues/32361).
1414
- Fixed an issue where the open Studio button would incorrectly show for component tests. Addressed in [#32315](https://github.com/cypress-io/cypress/pull/32315).
1515
- Fixed an issue where the TypeScript compiler wasn't being resolved correctly when `@cypress/webpack-batteries-included-preprocessor` was used as a standalone package. Fixes [#32338](https://github.com/cypress-io/cypress/issues/32338).
16+
- Fixed an issue where `tsx` was not being loaded correctly into the Cypress configuration process due to spaces being present in the path. Fixes [#32398](https://github.com/cypress-io/cypress/issues/32398).
1617

1718
**Misc:**
1819

packages/data-context/src/data/ProjectConfigIpc.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,11 @@ export class ProjectConfigIpc extends EventEmitter {
312312
/**
313313
* use --import for node versions
314314
* 20.6.0 and above for 20.x.x as --import is supported
315-
* use --loader for node under 20.6.0 for 20.x.x
315+
* use --loader for node under 20.6.0 for 20.x.x.
316+
* NOTE: we need to use double quotes around the tsx path to account for paths with spaces or special characters.
316317
* @see https://tsx.is/dev-api/node-cli#node-js-cli
317318
*/
318-
let tsxLoader = this.nodeVersion && semver.lt(this.nodeVersion, '20.6.0') ? `--loader ${tsx}` : `--import ${tsx}`
319+
let tsxLoader = this.nodeVersion && semver.lt(this.nodeVersion, '20.6.0') ? `--loader "${tsx}"` : `--import "${tsx}"`
319320

320321
// If they've got TypeScript installed, we can use tsx for CommonJS and ESM.
321322
// @see https://tsx.is/dev-api/node-cli#node-js-cli

packages/data-context/test/unit/data/ProjectConfigIpc.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ describe('ProjectConfigIpc', () => {
8585
// For node 20.5.1 and down, we need use the --loader flag
8686
expect(forkSpy).to.have.been.calledWith(sinon.match.string, sinon.match.array, sinon.match({
8787
env: {
88-
NODE_OPTIONS: sinon.match(/--loader .*cypress\/node_modules\/tsx\/dist\/loader.mjs/),
88+
NODE_OPTIONS: sinon.match(/--loader ".*cypress\/node_modules\/tsx\/dist\/loader.mjs"/),
8989
},
9090
}))
9191
} else {
9292
// For node 20.6.0 and up, we need use the --import flag
9393
expect(forkSpy).to.have.been.calledWith(sinon.match.string, sinon.match.array, sinon.match({
9494
env: {
95-
NODE_OPTIONS: sinon.match(/--import .*cypress\/node_modules\/tsx\/dist\/loader.mjs/),
95+
NODE_OPTIONS: sinon.match(/--import ".*cypress\/node_modules\/tsx\/dist\/loader.mjs"/),
9696
},
9797
}))
9898
}

packages/stderr-filtering/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "dist/index.js",
66
"scripts": {
77
"build": "yarn clean && tsc",
8-
"clean": "rm -rf ./{dist,coverage}",
8+
"clean": "rimraf -rf ./{dist,coverage}",
99
"lint": "eslint",
1010
"test": "vitest",
1111
"watch": "tsc --watch"
@@ -18,6 +18,7 @@
1818
"@types/node": "^22.13.10",
1919
"@vitest/coverage-v8": "^3.0.9",
2020
"eslint": "^9.22.0",
21+
"rimraf": "^6.0.1",
2122
"typescript": "^5.8.2",
2223
"vitest": "^3.0.9"
2324
},

yarn.lock

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17239,12 +17239,12 @@ foreach@~2.0.1:
1723917239
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
1724017240
integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k=
1724117241

17242-
foreground-child@^3.1.0:
17243-
version "3.1.1"
17244-
resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.1.1.tgz#1d173e776d75d2772fed08efe4a0de1ea1b12d0d"
17245-
integrity sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==
17242+
foreground-child@^3.1.0, foreground-child@^3.3.1:
17243+
version "3.3.1"
17244+
resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f"
17245+
integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==
1724617246
dependencies:
17247-
cross-spawn "^7.0.0"
17247+
cross-spawn "^7.0.6"
1724817248
signal-exit "^4.0.1"
1724917249

1725017250
forever-agent@~0.6.1:
@@ -18028,6 +18028,18 @@ glob@^10.2.2, glob@^10.3.10, glob@^10.3.12, glob@^10.3.3, glob@^10.3.7, glob@^10
1802818028
package-json-from-dist "^1.0.0"
1802918029
path-scurry "^1.11.1"
1803018030

18031+
glob@^11.0.0:
18032+
version "11.0.3"
18033+
resolved "https://registry.yarnpkg.com/glob/-/glob-11.0.3.tgz#9d8087e6d72ddb3c4707b1d2778f80ea3eaefcd6"
18034+
integrity sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==
18035+
dependencies:
18036+
foreground-child "^3.3.1"
18037+
jackspeak "^4.1.1"
18038+
minimatch "^10.0.3"
18039+
minipass "^7.1.2"
18040+
package-json-from-dist "^1.0.0"
18041+
path-scurry "^2.0.0"
18042+
1803118043
glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.0:
1803218044
version "7.2.3"
1803318045
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
@@ -20489,6 +20501,13 @@ jackspeak@^3.1.2:
2048920501
optionalDependencies:
2049020502
"@pkgjs/parseargs" "^0.11.0"
2049120503

20504+
jackspeak@^4.1.1:
20505+
version "4.1.1"
20506+
resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-4.1.1.tgz#96876030f450502047fc7e8c7fcf8ce8124e43ae"
20507+
integrity sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==
20508+
dependencies:
20509+
"@isaacs/cliui" "^8.0.2"
20510+
2049220511
jake@^10.8.5:
2049320512
version "10.8.5"
2049420513
resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.5.tgz#f2183d2c59382cb274226034543b9c03b8164c46"
@@ -22113,10 +22132,10 @@ lru-cache@^10.0.0, lru-cache@^10.0.1, lru-cache@^10.2.0, lru-cache@^10.2.2:
2211322132
resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119"
2211422133
integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==
2211522134

22116-
lru-cache@^11.0.2:
22117-
version "11.0.2"
22118-
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.0.2.tgz#fbd8e7cf8211f5e7e5d91905c415a3f55755ca39"
22119-
integrity sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==
22135+
lru-cache@^11.0.0, lru-cache@^11.0.2:
22136+
version "11.1.0"
22137+
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.1.0.tgz#afafb060607108132dbc1cf8ae661afb69486117"
22138+
integrity sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==
2212022139

2212122140
lru-cache@^4.0.1:
2212222141
version "4.1.5"
@@ -25642,6 +25661,14 @@ path-scurry@^1.11.1, path-scurry@^1.6.1:
2564225661
lru-cache "^10.2.0"
2564325662
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
2564425663

25664+
path-scurry@^2.0.0:
25665+
version "2.0.0"
25666+
resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.0.tgz#9f052289f23ad8bf9397a2a0425e7b8615c58580"
25667+
integrity sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==
25668+
dependencies:
25669+
lru-cache "^11.0.0"
25670+
minipass "^7.1.2"
25671+
2564525672
path-to-regexp@0.1.10:
2564625673
version "0.1.10"
2564725674
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b"
@@ -27828,6 +27855,14 @@ rimraf@^4.4.1:
2782827855
dependencies:
2782927856
glob "^9.2.0"
2783027857

27858+
rimraf@^6.0.1:
27859+
version "6.0.1"
27860+
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-6.0.1.tgz#ffb8ad8844dd60332ab15f52bc104bc3ed71ea4e"
27861+
integrity sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==
27862+
dependencies:
27863+
glob "^11.0.0"
27864+
package-json-from-dist "^1.0.0"
27865+
2783127866
ripemd160@=2.0.1:
2783227867
version "2.0.1"
2783327868
resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7"

0 commit comments

Comments
 (0)