You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes unit test failures in CI caused by Jest loading ESM-only uuid@14 from @contentstack/cli-utilities without transformation.
Problem
After dependency updates, connect-stack.test.ts and process-stack.test.ts failed in the Run Unit Tests workflow with:
@contentstack/cli-utilities@1.18.3 depends on uuid@^14.0.0, which publishes ESM under dist-node/. Jest was configured to transform only *.ts / *.tsx via ts-jest and ignored node_modules by default, so uuid was required as CommonJS and parsing failed.
Suites that mock @contentstack/cli-utilities (e.g. generate-output.test.ts) continued to pass.
Solution
Update Jest configuration to handle uuid only:
transformIgnorePatterns — exclude uuid from the default node_modules ignore so it can be transformed.
Scoped babel-jest transform — compile uuid.js files to CommonJS using @babel/preset-env.
@babel/preset-env — added as a devDependency to support the transform.
No changes to application source or test mocks.
Files changed
File
Change
jest.config.ts
transformIgnorePatterns + babel-jest transform for uuid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes unit test failures in CI caused by Jest loading ESM-only
uuid@14from@contentstack/cli-utilitieswithout transformation.Problem
After dependency updates,
connect-stack.test.tsandprocess-stack.test.tsfailed in the Run Unit Tests workflow with:@contentstack/cli-utilities@1.18.3depends onuuid@^14.0.0, which publishes ESM underdist-node/. Jest was configured to transform only*.ts/*.tsxviats-jestand ignorednode_modulesby default, souuidwas required as CommonJS and parsing failed.Suites that mock
@contentstack/cli-utilities(e.g.generate-output.test.ts) continued to pass.Solution
Update Jest configuration to handle
uuidonly:transformIgnorePatterns— excludeuuidfrom the defaultnode_modulesignore so it can be transformed.babel-jesttransform — compileuuid.jsfiles to CommonJS using@babel/preset-env.@babel/preset-env— added as a devDependency to support the transform.No changes to application source or test mocks.
Files changed
jest.config.tstransformIgnorePatterns+babel-jesttransform foruuidpackage.json@babel/preset-envdevDependencypackage-lock.json