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

Test development cycle is slow unless sourcemaps are turned off #5423

Closed
1 of 2 tasks
wardbell opened this issue Mar 14, 2017 · 5 comments · Fixed by #6160
Closed
1 of 2 tasks

Test development cycle is slow unless sourcemaps are turned off #5423

wardbell opened this issue Mar 14, 2017 · 5 comments · Fixed by #6160

Comments

@wardbell
Copy link
Contributor

wardbell commented Mar 14, 2017

The iterating unit test development is painfully slow (and appears to grow slower during a session) when running ng test.

The console shows re-build 92% complete and then hangs for up to a minute (it seems anyway) before finally reporting test progress and refreshing the karma browser.

The test progress reporter ticks along at a slow pace.

However, ng test --sourcemap=false (turning off sourcemaps) results in crisp iterations, with rebuild times in the sub-second range.

I'm describing my experience on a small app (the new Angular DocViewer) with fewer than 100 tests so far.

Bug Report or Feature Request (mark with an x)

  • bug report -> please search issues before submitting
  • feature request

Versions.

4.0.0-rc.2,
OS/X, node 6.9.5, npm 4.1.2

Repro steps.

  1. Open a CLI project with tests.
  2. Develop tests in a single spec file with ng test, changing frequently.
  3. Do the same again with ng test --sourcemap=false (soon to be --sourcemaps=false

Compare your experience.

Observations

I believe that in the typical dev/test cycle, the programmer changes a single test file 80% of the time, the corresponding application file 10% of the time, and hardly anything else the remaining 10%.

My sense is that it would be wise to optimize for this workflow.

@bialad
Copy link

bialad commented Mar 15, 2017

I reported this in #5334. Do you have any idea why serve/build is different than test?

@Meligy
Copy link
Contributor

Meligy commented Mar 16, 2017

With the default reporters and browser you should be seeing in console and browser, not completely hung.

The compilation experience is bad for me too (feels slower than ng build --watch), but not as horrible as described. Could be hardware or project size though (mine has over 180 tests still).

One workaround I use to speed that is to use fdescribe() or fit() to run only the test(s) you are modifying, saving a bit on the post-build times.

Often requires being careful though not to commit these. There are some 3rd party tslint rules that make that break the build, I'm considering adding one to my project.

@hccampos
Copy link

In our project it is extremely slow at first and then actually crashes due to node running out of memory (tries to go over 2GB or thereabouts).

@filipesilva
Copy link
Contributor

filipesilva commented Mar 18, 2017

Due to the way our karma setup work, we can't use a vendor chunk in unit tests as we use in serve/build since karma-webpack does not support it.

This slows down rebuilds and causes them to take a long time on chunk asset optimization due to processing sourcemaps.

@TheLarkInn has suggested using the DLLPlugin in unit tests, since he has seen similar setups with a lot of success.

filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 18, 2017
Blocked by angular#5500

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Fix angular#5332
Fix angular#5351
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 18, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Fix angular#5332
Fix angular#5351

BREAKING CHANGE:

The top level `files` and `include` options of `src/tsconfig.spec.json` should be removed.

The `src/typings.d.ts` file should be modified to contain the following:
```
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
  id: string;
}
```

Projects using TypeScript 2.0 or TypeScript 4.0 while NOT using tsconfig inheritance need to update the following files:

- `src/tsconfig.app.json`
- `src/tsconfig.spec.json`
- `e2e/tsconfig.e2e.json`

By adding the following entry to `compilerOptions`:

```
   "typeRoots": [
      "../node_modules/@types"
    ],
```
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 19, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Fix angular#5332
Fix angular#5351

BREAKING CHANGE:

Related to TypeStrong/ts-node#283

The `src/typings.d.ts` file should be modified to contain the following:
```
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
  id: string;
}
```
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 19, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Related to TypeStrong/ts-node#283
Fix angular#5332
Fix angular#5351

BREAKING CHANGE:

The following files need changes:

- `src/tsconfig.spec.json`: remove `files` and `include` entries. Add `"dom"` to the `lib` array.

- `src/typings.d.ts`: replace
```
declare var module: {
  id: string
}
```
with
```
declare var module: NodeModule;
interface NodeModule {
  id: string;
}
```
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 19, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Related to TypeStrong/ts-node#283
Fix angular#5332
Fix angular#5351

BREAKING CHANGE:

The following files need changes:

- `src/tsconfig.spec.json`: remove `files` and `include` entries. Add `"dom"` to the `lib` array if not using tsconfig inheritance.

- `src/typings.d.ts`: replace
```
declare var module: {
  id: string
}
```
with
```
declare var module: NodeModule;
interface NodeModule {
  id: string;
}
```
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 19, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Related to TypeStrong/ts-node#283
Fix angular#5332
Fix angular#5351
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 19, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Related to TypeStrong/ts-node#283
Fix angular#5332
Fix angular#5351
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 19, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Related to TypeStrong/ts-node#283
Fix angular#5332
Fix angular#5351
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 19, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Related to TypeStrong/ts-node#283
Fix angular#5332
Fix angular#5351
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 19, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Related to TypeStrong/ts-node#283
Fix angular#5332
Fix angular#5351
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 19, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Related to TypeStrong/ts-node#283

Fix angular#3911
Fix angular#5332
Fix angular#5351
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Mar 20, 2017
Blocked by angular#5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in angular#5423.

Related to TypeStrong/ts-node#283

Fix angular#3911
Fix angular#5332
Fix angular#5351
hansl pushed a commit that referenced this issue Mar 20, 2017
Blocked by #5500 (fix is included in this PR so that CI will run).

Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points.

This in turn was hiding errors related to typeRoots lookups.

It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile.

This might also have contributed to the overall slowness of unit tests in #5423.

Related to TypeStrong/ts-node#283

Fix #3911
Fix #5332
Fix #5351
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 3, 2017
This PR uses a new Karma plugin to enable vendor bundles in unit tests,
increasing rebuild performance.

On a medium size project rebuilds times were 15x smaller (16.5s to 0.9s).

Fix angular#5423
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 3, 2017
This PR uses a new Karma plugin to enable vendor bundles in unit tests,
increasing rebuild performance.

On a medium size project rebuilds times were 15x smaller (16.5s to 0.9s).

Fix angular#5423
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 4, 2017
This PR uses a new Karma plugin to enable vendor bundles in unit tests,
increasing rebuild performance.

On a medium size project rebuilds times were 15x smaller (16.5s to 0.9s).

Fix angular#5423
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 5, 2017
This PR uses a new Karma plugin to enable vendor bundles in unit tests,
increasing rebuild performance.

On a medium size project rebuilds times were 15x smaller (16.5s to 0.9s).

Fix angular#5423
filipesilva added a commit that referenced this issue May 8, 2017
This PR uses a new Karma plugin to enable vendor bundles in unit tests,
increasing rebuild performance.

On a medium size project rebuilds times were 15x smaller (16.5s to 0.9s).

Fix #5423
dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this issue Apr 23, 2018
This PR uses a new Karma plugin to enable vendor bundles in unit tests,
increasing rebuild performance.

On a medium size project rebuilds times were 15x smaller (16.5s to 0.9s).

Fix angular#5423
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants