Skip to content

🐛 tech-insights-backend: Forbidden dependency on @backstage/backend-test-utils #1715

@rohitmishr

Description

@rohitmishr

🔖 Need

Issue: ReferenceError: jest is not defined

Context: We recently upgraded our Backstage version and created a custom TechInsights plugin. This plugin has a dependency on @backstage/backend-test-utils. When attempting to run yarn dev, we encounter the following error:

/Users/rxxxmxxxx/Documents/bug-fix-tech-insights/xyzz-idp-app/packages/backend/node_modules/@backstage-community/plugin-tech-insights-backend/node_modules/@backstage/backend-test-utils/src/next/services/mockServices.ts:64
child: jest.fn().mockImplementation(createLoggerMock),
^

ReferenceError: jest is not defined
at createLoggerMock (/Users/rxxxmxxxx/Documents/bug-fix-tech-insights/xyzz-idp-app/packages/backend/node_modules/@backstage-community/plugin-tech-insights-backend/node_modules/@backstage/backend-test-utils/src/next/services/mockServices.ts:64)

Steps Taken:

  1. Upgraded Backstage version.
  2. Created a custom TechInsights plugin.
  3. Added @backstage/backend-test-utils as a dependency.
  4. Ran yarn dev.

Error Details:

  • The error occurs in the mockServices.ts file at line 64. (inside my node_modules of backend I am able to see this path "backend/node_modules/@backstage-community/plugin-tech-insights-backend/node_modules/@backstage/backend-test-utils/src/next/services/mockServices.ts:64")
  • It seems that jest is not defined in the context where createLoggerMock is being called.

Request for Help: Could anyone provide guidance on how to resolve this ReferenceError? Specifically, how can we ensure that jest is properly defined and available in the context of mockServices.ts?

🎉 Proposal

Issue: ReferenceError: jest is not defined
Context: We recently upgraded our Backstage version and created a custom TechInsights plugin. This plugin has a dependency on @backstage/backend-test-utils. When attempting to run yarn dev, we encounter the following error:

/Users/rxxxmxxxx/Documents/bug-fix-tech-insights/xyzz-idp-app/packages/backend/node_modules/@backstage-community/plugin-tech-insights-backend/node_modules/@backstage/backend-test-utils/src/next/services/mockServices.ts:64
child: jest.fn().mockImplementation(createLoggerMock),
^

ReferenceError: jest is not defined
at createLoggerMock (/Users/rxxxmxxxx/Documents/bug-fix-tech-insights/xyzz-idp-app/packages/backend/node_modules/@backstage-community/plugin-tech-insights-backend/node_modules/@backstage/backend-test-utils/src/next/services/mockServices.ts:64)

when we checked this repo link for latest @backstage/backend-test-utils but after doing yarn install and yarn dev we are getting jest not define.

〽️ Alternatives

No response

❌ Risks

No response

👀 Have you spent some time to check if this RFC has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is neededstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions