JeremyYao opened a new pull request, #1626:
URL: https://github.com/apache/daffodil-vscode/pull/1626

   Closes #1557
   
   ## Description
   
   Fixed Svelte test execution failure on Node.js 22 by switching from 
`ts-node/register` (CommonJS loader) to `tsx` (ESM-native TypeScript runner).
   
   The previous test configuration used `mocha -r ts-node/register`, which 
relies on CommonJS `require()` hooks. When tests imported Svelte 5+ modules 
(pure ESM), Node.js 22 threw an `ERR_INTERNAL_ASSERTION` error due to stricter 
ESM/CJS boundary enforcement—specifically a race condition when synchronously 
requiring an ES module that's being asynchronously loaded.
   
   **Error message:**
   ```
   Cannot require() ES Module .../node_modules/svelte/src/store/index-server.js 
because it is not yet fully loaded
   ```
   
   **Fix:** Replaced `ts-node/register` with `tsx`, which handles ESM/CJS 
interop correctly by processing TypeScript through Node's native ESM pipeline 
rather than the CJS require system.
   
   ## Wiki
   
   - [x] I have determined that no documentation updates are needed for these 
changes
   - [ ] I have added the following documentation for these changes
   
   ## Review Instructions
   
   1. Ensure you're on Fedora 43 (or any system with Node.js 22.x)
   2. Remove existing installations of Node and Node Version Managers
   3. On Fedora 43, install node via `sudo dnf install nodejs`
   4. You may have to install yarn via `npm install --global yarn`
   5. Run `yarn install` to fetch the new `tsx` dev dependency
   6. Run `yarn test:svelte`
   
   Tests should pass without the ESM/CJS race condition error.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to