Multi App Test Command - Doesn't pick up app name
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.3.0
node: 8.2.0
os: win32 x64
@angular/animations: 4.3.6
@angular/common: 4.3.6
@angular/compiler: 4.3.6
@angular/core: 4.3.6
@angular/forms: 4.3.6
@angular/http: 4.3.6
@angular/platform-browser: 4.3.6
@angular/platform-browser-dynamic: 4.3.6
@angular/router: 4.3.6
@angular/cli: 1.3.0
@angular/compiler-cli: 4.3.6
@angular/language-service: 4.3.6
Repro steps.
If you put two apps into the generated angular cli project you can suppply the --app
parameter and get each app to serve.
However I can’t seem to get this to do the same thing with a test the following steps are contained in this repo:
https://github.com/sethreidnz/angular-cli-multi-app-test-repro
But repeated here:
First clone this repo:
git clone https://github.com/sethreidnz/angular-cli-multi-app-test-repro
Install the npm packages:
npm install
``
If you serve them with the following commands they run fine:
```bash
ng serve --app app1
ng serve --app app2
You will see that the apps have different titles, this is the only difference between their files contained in folders /app1
and /app2
.
However if you try to run the tests as in the test help command:
ng test -h
With the parameter --app
like so:
ng test --sr --app app1
ng test --sr --app app2
You will get the exact same error:
Expected 'APP 1!' to equal 'app'.
Even though they both have a different title
property in their respective app/app.component.ts
. You would expect the app2
test to have an error like:
Expected 'app 2!' to equal 'app'.
Desired functionality.
Be able to run each projects test by passing the --app
parameter equal to the app definition in the .angular-cli.json file.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
@csaadaam I think you need to include an extra entry for the polyfills,
I ran into this problem today, it looks like it always takes the first app when building the webpack config for testing,
https://github.com/angular/angular-cli/blob/1.4.x/packages/%40angular/cli/models/webpack-configs/test.ts#L22
I ended up working around this problem by providing another
karma.config.js
for the second app that overrides thewebpack.entry
config with the correct entries.