swc: range end index out of range for slice of length...
Describe the bug
This is an intermittent bug with @swc/jest and/or @swc/core.
We are running our test suite with turbo repo, utilizing @swc/jest, and intermittently we get a failure like this:
failed to handle: range end index 7551504 out of range for slice of length 6467552
@ssi/document-landing:test:
@ssi/document-landing:test: at Compiler.transformSync (../../node_modules/@swc/core/index.js:241:29)
@ssi/document-landing:test: at transformSync (../../node_modules/@swc/core/index.js:348:21)
@ssi/document-landing:test: at Object.process (../../node_modules/@swc/jest/index.js:73:45)
Retrying the ci/cd job and it will succeed just fine.
This does not happen very often, but ~1/50 runs. That error message appears to be from rust, which is pointing me more towards it being an @swc issue, than a jest specific issue.
Input code
No response
Config
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
}
},
"module": {
"type": "commonjs"
}
}
Playground link
No response
Expected behavior
Test suites should not intermittently fail with no changes
Actual behavior
Fails intermittently
Version
1.2.128
Additional context
“@swc/cli”: “^0.1.57”, “@swc/core”: “^1.2.128”, “@swc/jest”: “^0.2.15”,
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 20 (9 by maintainers)
It’s not a something we can look into
I can relate to that. I tried using the GitHub Actions runner and everything went smoothly. However, when using our self-hosted runner in parallel mode, we encountered some issues. To mitigate the problem, I tried running it with the
--runInBand
option, and while the issue still occurred, it became less frequent.https://github.com/wasmerio/wasmer/blob/2.3.0/lib/engine-universal/src/artifact.rs#L102 is the correct link
Can you try
RUST_BACKTRACE=1
?