backstage: πŸ› Bug Report: Running tests with extra jest config in package.json

πŸ“œ Description

When running yarn backstage-cli repo test from the root of the workspace when i have some additional jest config in the package.json i get errors when running at the repo root but not when running inside each package.

πŸ‘ Expected behavior

Tests should run and include config from package.json, in this case the extra reporter should run and i should get junit xml file in each package.

πŸ‘Ž Actual Behavior with Screenshots

I get the following in the command line when running CI=true yarn backstage-cli repo test

The tests do still run but without any of the extra config.

yarn run v1.22.19
$ /Users/scott/Code/greenroom/backstage/node_modules/.bin/backstage-cli package test
● Validation Warning:

  Unknown option "coverageDirectory" with value "/Users/scott/Code/greenroom/backstage/packages/app/coverage" was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

● Validation Warning:

  Unknown option "coverageProvider" with value "v8" was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

● Validation Warning:

  Unknown option "collectCoverageFrom" with value ["**/*.{js,jsx,ts,tsx,mjs,cjs}", "!**/*.d.ts"] was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

● Validation Warning:

  Unknown option "reporters" with value ["default", "jest-github-actions-reporter", ["jest-junit", {"ancestorSeparator": " β€Ί ", "classNameTemplate": "{classname}", "outputDirectory": "reports", "outputName": "report", "suiteNameTemplate": "{filepath}", "titleTemplate": "{title}", "uniqueOutputName": "true"}]] was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

but when running inside a package/plugin I don’t see this issue and the extra config is picked up correctly and i get the junit reports created…

πŸ‘Ÿ Reproduction steps

Add the following in the package.json

...
"jest": {
    "testPathIgnorePatterns": [
      "/node_modules/",
      "/__fixtures__/"
    ],
    "reporters": [
      "default",
      "jest-github-actions-reporter",
      [
        "jest-junit",
        {
          "outputDirectory": "reports",
          "outputName": "report",
          "uniqueOutputName": "true",
          "ancestorSeparator": " β€Ί ",
          "suiteNameTemplate": "{filepath}",
          "classNameTemplate": "{classname}",
          "titleTemplate": "{title}"
        }
      ]
    ]
  }
...

And then run CI=true yarn backstage-cli repo test results in some validation errors from jest like this

πŸ“ƒ Provide the context for the Bug.

I want to enable to extra reporters for jest so i can use the test results for futher reporting.

This did used to work but has stopped at some point and i have come across this error when debugging.

πŸ–₯️ Your Environment

yarn run v1.22.19 $ /Users/scott/Code/greenroom/backstage/node_modules/.bin/backstage-cli info OS: Darwin 21.6.0 - darwin/arm64 node: v18.12.1 yarn: 1.22.19 cli: 0.21.1 (installed) backstage: 1.8.2

Dependencies: @backstage/app-defaults 1.0.8 @backstage/backend-common 0.16.0 @backstage/backend-plugin-api 0.1.4 @backstage/backend-tasks 0.3.7 @backstage/catalog-client 1.1.2 @backstage/catalog-model 1.1.3 @backstage/cli-common 0.1.10 @backstage/cli 0.20.0, 0.21.1 @backstage/config-loader 1.1.6 @backstage/config 1.0.4 @backstage/core-app-api 1.2.0 @backstage/core-components 0.11.2, 0.12.0 @backstage/core-plugin-api 1.1.0 @backstage/dev-utils 1.0.8 @backstage/errors 1.1.3 @backstage/integration-react 1.1.6 @backstage/integration 1.4.0 @backstage/plugin-api-docs 0.8.11 @backstage/plugin-app-backend 0.3.38 @backstage/plugin-auth-backend 0.17.1 @backstage/plugin-auth-node 0.2.7 @backstage/plugin-catalog-backend-module-github 0.2.1 @backstage/plugin-catalog-backend 1.5.1 @backstage/plugin-catalog-common 1.0.8 @backstage/plugin-catalog-graph 0.2.23 @backstage/plugin-catalog-import 0.9.1 @backstage/plugin-catalog-node 1.2.1 @backstage/plugin-catalog-react 1.2.1 @backstage/plugin-catalog 1.6.1 @backstage/plugin-github-actions 0.5.11 @backstage/plugin-home 0.4.27 @backstage/plugin-org 0.6.1 @backstage/plugin-permission-common 0.7.1 @backstage/plugin-permission-node 0.7.1 @backstage/plugin-permission-react 0.4.7 @backstage/plugin-proxy-backend 0.2.32 @backstage/plugin-scaffolder-backend 1.8.0 @backstage/plugin-scaffolder-common 1.2.2 @backstage/plugin-scaffolder 1.8.0 @backstage/plugin-search-backend-node 1.0.4 @backstage/plugin-search-backend 1.1.1 @backstage/plugin-search-common 1.1.1 @backstage/plugin-search-react 1.2.1 @backstage/plugin-search 1.0.4 @backstage/plugin-stack-overflow-backend 0.1.7 @backstage/plugin-stack-overflow 0.1.7 @backstage/plugin-tech-radar 0.5.18 @backstage/plugin-techdocs-backend 1.4.1 @backstage/plugin-techdocs-module-addons-contrib 1.0.6 @backstage/plugin-techdocs-node 1.4.2 @backstage/plugin-techdocs-react 1.0.6 @backstage/plugin-techdocs 1.4.0 @backstage/plugin-user-settings 0.5.1 @backstage/release-manifests 0.0.6, 0.0.7 @backstage/test-utils 1.2.2 @backstage/theme 0.2.16 @backstage/types 1.0.1 @backstage/version-bridge 1.0.2 Done in 0.61s.

πŸ‘€ Have you spent some time to check if this bug has been raised before?

  • I checked and didn’t find similar issue

🏒 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (14 by maintainers)

Most upvoted comments

I can work on this issue. It will be my first contribution, so I may need guidance.

Is there any activity on this issue?

This isn’t stale it still seems to be an issue.