Sonarcloud with monorepo

We are trying to run sonar on Angular monorepo. Tests are failing because of following error.
error TS2307: Cannot find module ‘./generated/build-version’. 1 export { BUILD_VERSION } from ‘./generated/build-version’;

please help in fixing this issue.
Below is the bitbucket pipeline configuration:

- step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        image: node:12.21.0
        caches:
          - node
          - sonar
        script:
          - npm ci --quiet
          - npm run test --code-coverage --no-watch --no-progress --browsers=ChromeHeadlessNoSandbox
          - pipe: sonarsource/sonarcloud-scan:1.2.0
            variables:
              SONAR_TOKEN: ${SONAR_TOKEN}
              EXTRA_ARGS: '-Dsonar.sources=src -Dsonar.tests=src -Dsonar.test.inclusions="**/testing/**,**/*.spec.ts" -Dsonar.typescript.lcov.reportPaths=coverage/lcov.info'

When you say tests are failing… Is it the npm run test ... command that fails? Or is it the sonarcloud-scan pipe? If it’s the npm command, then only you can fix it, it’s outside of our scope.