Please provide us with the following information:
Mac OSX Sierra
@angular/cli: 1.0.0-beta.32.3
node: 6.9.5
os: darwin x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-beta.32.3
@angular/compiler-cli: 2.4.8
ng new my-app; cd my-app; ng e2e --environment=prod
Can you provide some additional information?What are you expecting and what is actually happening?
@clydin I'm importing environment in e2e tests like this:
import { environment } from '../src/environments/environment';
console.log(environment);
and expect the actual environment imported to depend on --environment flags
@tsabirgaliev environment replacement only works in your app and unit tests. e2e tests are their own separate app, outisde webpack, and do not support that feature.
Hello,
and how we will make e2e tests for all the different environments that we have if it accepts by default only the enviroment.ts?
I was able to get it working, details here.
I confirm: ng e2e works with -e or --environment flag with CLI in version 1.5.5.
The e2e docs state
Please note that options that are supported by ng serve are also supported by ng e2e
And from the serve docs
--environment (aliases: -e)
Defines the build environment.
But when I do ng e2e --environment prod he is still picking up the test environment. It looks like the CLI is checking but ignoring it since
ng e2e --environment whatever
Environment "whatever" does not exist.
IMHO its working partly. The server is starting and providing the environment to the app but it is not available in e2e tests.
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._
Most helpful comment
Hello,
and how we will make e2e tests for all the different environments that we have if it accepts by default only the enviroment.ts?