Title: TestBed.configureTestingModule Performance Issue · Issue #12409 · angular/angular · GitHub
Open Graph Title: TestBed.configureTestingModule Performance Issue · Issue #12409 · angular/angular
X Title: TestBed.configureTestingModule Performance Issue · Issue #12409 · angular/angular
Description: I'm submitting a ... (check one with "x") [ ] bug report [x] feature request [ ] support request Current behavior Importing modules into TestBed.configureTestingModule can slow tests down substantially. We have a 'shared module' with par...
Open Graph Description: I'm submitting a ... (check one with "x") [ ] bug report [x] feature request [ ] support request Current behavior Importing modules into TestBed.configureTestingModule can slow tests down substanti...
X Description: I'm submitting a ... (check one with "x") [ ] bug report [x] feature request [ ] support request Current behavior Importing modules into TestBed.configureTestingModule can slow tests ...
Opengraph URL: https://github.com/angular/angular/issues/12409
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TestBed.configureTestingModule Performance Issue","articleBody":"\u003c!--\nIF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATING\n-->\n\n**I'm submitting a ...** (check one with \"x\")\n\n```\n[ ] bug report \n[x] feature request\n[ ] support request \n```\n\n**Current behavior**\n\n\u003c!-- Describe how the bug manifests. -->\n\nImporting modules into `TestBed.configureTestingModule` can slow tests down _substantially_. We have a 'shared module' with parts, that lots of our components use, including a third party library or two. It is very convenient to import this module as a rather than cherry pick in the tests, however testing a small component yesterday, I saw test bootstrap taking _two whole seconds_ and had to cherry-pick dependencies to make tests run reliably.\n\n**Expected behavior**\n\n\u003c!-- Describe what the behavior would be without the bug. -->\n\n`TestBed.configureTestingModule` should be performant. \n\n**Minimal reproduction of the problem with instructions**\n\n\u003c!--\nIf the current behavior is a bug or you can illustrate your feature request better with an example, \nplease provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the problem via\nhttps://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).\n-->\n\nIn [this plunker](http://plnkr.co/edit/SXi7UW01I43zSCmr8Emp?p=preview)\n1. go to the `src/simple.spec.ts` and comment and un-comment the `SharedModule` import into `configureTestingModule`.\n1. Observe time it takes for test to run.\n\nI am seeing a jump from 0.079s to 0.241s. (~= 3x slower). Multiply that by 5 cases and this simple test takes a whole second. Make the shared module larger and you have real problems.\n\n**What is the motivation / use case for changing the behavior?**\n\n\u003c!-- Describe the motivation or the concrete use case -->\n1. Slow tests hurt TDD workflow\n2. Slow enough tests disconnect karma from the browser and fail the suite.\n\n**Please tell us about your environment:**\n\n\u003c!-- Operating system, IDE, package manager, HTTP server, ... -->\n\nWin10, VsCode, Webpack, \n- **Angular version:** 2.0.X\n \n \u003c!-- Check whether this is still an issue in the most recent Angular version -->\n \n Yes.\n- **Browser:** Locally, PhantomJS. Plunk tested in Chrome.\n- **Language:** TypeScript (though tests are transpiled to ES5 prior to running, naturally)\n\n_Note:_ Even as I write this, I wonder if it's a reasonable expectation for large modules to go through TestBed quickly? Maybe I'm just doing something wrong architecturally, (use multiple, smaller shared modules, not one big one, etc.) However, tests are time-consuming enough without having to track down every individual dependency of a more complex component just to get started.\n","author":{"url":"https://github.com/ollwenjones","@type":"Person","name":"ollwenjones"},"datePublished":"2016-10-20T15:52:41Z","url":"https://github.com/angular/angular/issues/12409"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:83c4a8d6-1cc9-efab-01e8-50ae14efa5a4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80AE:3C21B:3165DA2:3F26C20:6B01C26B |
| html-safe-nonce | a4df116d806d87ac11302becd78d04ef99d13256683ee938060f06c980d86020 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEFFOjNDMjFCOjMxNjVEQTI6M0YyNkMyMDo2QjAxQzI2QiIsInZpc2l0b3JfaWQiOiI0MTEyOTA4MTM1MjQzNTYzNjI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 90b96b57a2b59a9c1f13fb0490bb179e1a7e0aa71fea853019a9f28fbfd3adc3 |
| hovercard-subject-tag | issue:184268919 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/12409/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0d852ec5088f024512c36335406d2f8d447e0efbb1757f2a508e99c6745ef5fa/angular/angular/issues/12409 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0d852ec5088f024512c36335406d2f8d447e0efbb1757f2a508e99c6745ef5fa/angular/angular/issues/12409 |
| og:image:alt | I'm submitting a ... (check one with "x") [ ] bug report [x] feature request [ ] support request Current behavior Importing modules into TestBed.configureTestingModule can slow tests down substanti... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ollwenjones |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width