Skip to content

Enable Support for Running Jest Tests From Workspace Version#7867

Open
awanlin wants to merge 3 commits intobackstage:mainfrom
awanlin:topic/enable-jest-30
Open

Enable Support for Running Jest Tests From Workspace Version#7867
awanlin wants to merge 3 commits intobackstage:mainfrom
awanlin:topic/enable-jest-30

Conversation

@awanlin
Copy link
Contributor

@awanlin awanlin commented Feb 27, 2026

Hey, I just made a Pull Request!

This PR enables support for running Jest test from the Workspace. The reason this is needed is that we have and old version of the @backstage/cli package in the root of this repo that still contains Jest. If we were to bump it or remove it all the workspaces would break. This approach allows us to migrate workspace by workspace.

"@backstage/cli": "^0.32.0",

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

Signed-off-by: Andre Wanlin <awanlin@spotify.com>
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
@awanlin awanlin marked this pull request as ready for review February 27, 2026 21:06
@awanlin awanlin requested a review from a team as a code owner February 27, 2026 21:06
@awanlin awanlin requested a review from Parsifal-M February 27, 2026 21:06
Comment on lines +169 to +176
run: |
if node -e "const p = require('./package.json'); process.exit(p.devDependencies?.jest ? 0 : 1)"; then
echo "Using Jest 30"
./node_modules/.bin/backstage-cli repo test --coverage --maxWorkers=3
else
echo "Using Jest 29 from the Backstage CLI"
yarn backstage-cli repo test --coverage --maxWorkers=3
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we do this instead? 🤔

Suggested change
run: |
if node -e "const p = require('./package.json'); process.exit(p.devDependencies?.jest ? 0 : 1)"; then
echo "Using Jest 30"
./node_modules/.bin/backstage-cli repo test --coverage --maxWorkers=3
else
echo "Using Jest 29 from the Backstage CLI"
yarn backstage-cli repo test --coverage --maxWorkers=3
fi
run: ./node_modules/.bin/backstage-cli repo test --coverage --maxWorkers=3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants