Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup noise from unit tests #18196

Merged
merged 4 commits into from May 16, 2022
Merged

Cleanup noise from unit tests #18196

merged 4 commits into from May 16, 2022

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented May 11, 2022

Issue:

What I did

Added baseUrl to mocked ng workspace tsconfigs, to get rid of this error:

Failed to load /tmp/storybook/app/angular/src/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json: Missing baseUrl in compilerOptions
Failed to load /tmp/storybook/app/angular/src/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json: Missing baseUrl in compilerOptions
Failed to load /tmp/storybook/app/angular/src/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json: Missing baseUrl in compilerOptions
 PASS  app/angular/src/server/framework-preset-angular-cli.test.ts (11.773 s)

Updated jest-preset-angular usage, to get rid of this error:

ts-jest[root] (WARN) Import setup jest file via `import 'jest-preset-angular';` is deprecated and will be removed in v9.0.0. Please switch to `import 'jest-preset-angular/setup-jest';`

Switched rejected value mock in a test to get rid of this noise:

ERR! Error: 
ERR!     at /tmp/storybook/app/angular/src/builders/start-storybook/index.spec.ts:127:43
ERR!     at Generator.next (<anonymous>)
ERR!     at /tmp/storybook/app/angular/src/builders/start-storybook/index.spec.ts:27:71
ERR!     at new ZoneAwarePromise (/tmp/storybook/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:1347:33)
ERR!     at Object.<anonymous>.__awaiter (/tmp/storybook/app/angular/src/builders/start-storybook/index.spec.ts:23:12)
ERR!     at /tmp/storybook/app/angular/src/builders/start-storybook/index.spec.ts:126:39
ERR!     at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (/tmp/storybook/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:407:30)
ERR!     at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/tmp/storybook/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3765:43)
ERR!     at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (/tmp/storybook/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:406:56)
ERR!     at Zone.Object.<anonymous>.Zone.run (/tmp/storybook/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:167:47)
ERR!     at Object.wrappedFunc (/tmp/storybook/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4250:34)
ERR!     at Object.asyncJestTest (/tmp/storybook/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
ERR!     at /tmp/storybook/node_modules/jest-jasmine2/build/queueRunner.js:45:12
ERR!     at new Promise (<anonymous>)
ERR!     at mapper (/tmp/storybook/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
ERR!     at /tmp/storybook/node_modules/jest-jasmine2/build/queueRunner.js:75:41

Suppressed console logs in angular test, to get rid of the incredible amount of logs about enableProdMode:

PASS  app/angular/src/client/preview/angular-beta/RendererFactory.test.ts
  ● Console

    console.log
      Angular is running in development mode. Call enableProdMode() to enable production mode.

      at Console.Object.<anonymous>.Console.log (../../../packages/core/src/console.ts:15:13)
          at Array.forEach (<anonymous>)

    console.log
      Angular is running in development mode. Call enableProdMode() to enable production mode.

      at Console.Object.<anonymous>.Console.log (../../../packages/core/src/console.ts:15:13)
          at Array.forEach (<anonymous>)

    console.log
      Angular is running in development mode. Call enableProdMode() to enable production mode.

      at Console.Object.<anonymous>.Console.log (../../../packages/core/src/console.ts:15:13)
          at Array.forEach (<anonymous>)

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

If your answer is yes to any of these, please make sure to include it in your PR.

@yannbf yannbf added the maintenance User-facing maintenance tasks label May 11, 2022
@nx-cloud
Copy link

nx-cloud bot commented May 11, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 7198662. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@yannbf yannbf changed the title update jest-preset-angular configs Cleanup noise from unit tests May 11, 2022
@yannbf yannbf force-pushed the chore/fix-angular-test-presets branch from 293d03f to 7198662 Compare May 16, 2022 10:44
Copy link
Contributor

@kylegach kylegach left a comment

Choose a reason for hiding this comment

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

LGTM!

@yannbf yannbf merged commit 3e2b7f1 into next May 16, 2022
@yannbf yannbf deleted the chore/fix-angular-test-presets branch May 16, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants