Reputation: 16675
When I run ember serve
while logging out the environment
variable in config/environment.js
, I see three values logged:
undefined
development
test
(This is in an inherited project.)
In a fresh app created using ember new my-app
, I see three values also:
development
test
development
Which leads me to believe my inherited project is running in test
mode and a fresh project is running in development
mode as I would expect.
Running ember serve --environment=development
does not change the observed behavior in the inherited project.
My questions are why do I see three values logged when running ember serve
and how can I figure out why my development environment is running in test
?
Upvotes: 0
Views: 191
Reputation: 1368
Whatever calls project.config(environment)
is what dictates the environment
argument in the config function. If anything calls this function without an argument then you'll see undefined
.
As for determining why it's running in test mode, I'd try throwing a debugger statement in your editor (if possible) then see what's calling it with "test"
. If that's not possible then try printing a call stack somewhere in the function:
module.exports = function(environment) {
...
console.log('current environment: ', environment);
console.log(new Error().stack);
}
You'll see something like:
CURRENT ENVIRONMENT: development
Error
at module.exports (.../config/environment.js:73:15)
at Project.configWithoutCache (.../node_modules/ember-cli/lib/models/project.js:273:47)
at Project.config (.../node_modules/ember-cli/lib/models/project.js:257:21)
at Watcher.module.exports [as serveURL] (.../node_modules/ember-cli/lib/utilities/get-serve-url.js:6:24)
at Watcher.didChange (.../node_modules/ember-cli/lib/models/watcher.js:51:40)
at Watcher.emit (events.js:187:15)
at Watcher.triggerChange (.../node_modules/ember-cli-broccoli-sane-watcher/index.js:174:8)
at tryCatcher (.../node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:323:19)
at invokeCallback (.../node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:495:31)
at publish (.../node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:481:7)
at flush (.../node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:2402:5)
at process._tickCallback (internal/process/next_tick.js:61:11)
where you can work your way back to see what's setting the environment (in this case it's ember-cli
).
Upvotes: 1