-
Notifications
You must be signed in to change notification settings - Fork 26.5k
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 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.
Expected behavior
TestBed.configureTestingModule
should be performant.
Minimal reproduction of the problem with instructions
In this plunker
- go to the
src/simple.spec.ts
and comment and un-comment theSharedModule
import intoconfigureTestingModule
. - Observe time it takes for test to run.
I 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.
What is the motivation / use case for changing the behavior?
- Slow tests hurt TDD workflow
- Slow enough tests disconnect karma from the browser and fail the suite.
Please tell us about your environment:
Win10, VsCode, Webpack,
-
Angular version: 2.0.X
Yes.
-
Browser: Locally, PhantomJS. Plunk tested in Chrome.
-
Language: TypeScript (though tests are transpiled to ES5 prior to running, naturally)
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.