I want to pick file src/enironments/environment.docker.ts
when I run a dockerized version of my e2e testing.
I have added a new e2e section to angular.json
"myapp-e2e": {
...
},
"myapp-e2e-docker": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "myapp:serve:docker"
}
}
}
I have added a configuration to my serve section:
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "myapp:build"
},
"configurations": {
"production": {
"browserTarget": "myapp:build:production"
},
"docker": {
"browserTarget": "myapp:build:docker"
}
}
}
And a configuration to my build section:
"docker": {
...
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.docker.ts"
}
]
}
Then I invoke my e2e conf like so
ng e2e myapp-e2e-docker
It seem to do what I expect. If, for example, I misspell the name of the environment.docker.ts file it will complain that it can not find it. But then, reading the content of the environment at run-time, I always find the values from src/environments/environment.ts
Is this some kind of bug? It looks like that the features for the ng serve
facility are not available for the ng e2e
.
My package.json file:
"devDependencies": {
"@angular-devkit/build-angular": "0.12.1",
"@angular/language-service": "6.1.0",
"@types/jasmine": "3.0.0",
"@types/jasminewd2": "2.0.6",
"@types/node": "6.0.60",
"codelyzer": "4.2.1",
"jasmine-core": "3.3.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "3.1.1",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "2.0.4",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.0",
"protractor": "5.3.0",
"ts-node": "7.0.1",
"tslint": "5.3.2",
"typescript": "2.9.2"
}