next.js
8f2e058c - test: fix failures caused by format discrepancies between rspack and other bundlers (#80314)

Commit
321 days ago
test: fix failures caused by format discrepancies between rspack and other bundlers (#80314) This pull request updates error recovery tests to improve compatibility with the Rspack bundler by introducing an `isRspack` flag and modifying test cases to handle Rspack-specific error formats. The changes ensure that runtime and build errors are correctly detected and displayed when using Rspack. ### Rspack Compatibility Updates: * Introduced the `isRspack` flag to determine if Rspack is being used, based on the `NEXT_RSPACK` environment variable. This flag replaces direct checks of `process.env.NEXT_RSPACK` for better readability and maintainability. (`test/development/acceptance-app/error-recovery.test.ts` [[1]](diffhunk://#diff-ed42d009889881804f76e500465e132e4aa1df75c8659119e1b5cff4d230b7cdR8-R9) `test/development/acceptance/error-recovery.test.ts` [[2]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91R9) * Updated test cases in `error-recovery.test.ts` and `acceptance-app/error-recovery.test.ts` to handle Rspack-specific error messages. This includes adapting error expectations for syntax errors, runtime errors, and build errors with the Rspack error format. (`test/development/acceptance-app/error-recovery.test.ts` [[1]](diffhunk://#diff-ed42d009889881804f76e500465e132e4aa1df75c8659119e1b5cff4d230b7cdR58-R79) [[2]](diffhunk://#diff-ed42d009889881804f76e500465e132e4aa1df75c8659119e1b5cff4d230b7cdR574-R588) [[3]](diffhunk://#diff-ed42d009889881804f76e500465e132e4aa1df75c8659119e1b5cff4d230b7cdR845-R872); `test/development/acceptance/error-recovery.test.ts` [[4]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91L58-R74) [[5]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91L372-R394) [[6]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91L755-R766) * Replaced outdated error message formats in Rspack-related test cases with updated and more precise error descriptions, including detailed stack traces and error causes. (`test/development/acceptance/error-recovery.test.ts` [[1]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91L815-R835) [[2]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91L883-R903) These changes improve test coverage for Rspack and ensure robust error handling across different bundlers.
Parents
Loading