Server is undefined while in test environment
See original GitHub issueFirst and foremost, thanks for writing up this addon! It is such a great addition to the community.
Problem
When running tests at http://localhost:4200/tests I’m getting ReferenceError: server is not defined
. Not sure exactly how this might be happening since I’ve enabled ember-cli-mirage for testing mode only.
Note: This error does not occur when running ember test
config/environment.js
module.exports = function(environment) {
var ENV = {
modulePrefix: 'cio',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {}
},
APP: {}
};
ENV.APP.FORCE_REST_ADAPTER = false
ENV.APP.PROFILE_RENDERS = false
// Disable ember-cli-mirage by default, we want to use our local api for development
ENV['ember-cli-mirage'] = {
enabled: false
};
if (environment === 'development') {}
if (environment === 'production') {}
if (environment === 'test') {
ENV['ember-cli-mirage'] = {
enabled: true
};
// Root Element
ENV.APP.rootElement = '#ember-testing';
// Testem prefers this...
ENV.baseURL = '/';
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
return ENV;
};
Issue Analytics
- State:
- Created 8 years ago
- Comments:24 (12 by maintainers)
Top Results From Across the Web
Server is undefined while in test environment #81 - GitHub
Problem When running tests at http://localhost:4200/tests I'm getting ReferenceError: ... Server is undefined while in test environment #81.
Read more >next.js environment variables are undefined (Next.js 10.0.5)
But in my console I get a "test undefined". I tried to put my variable into an .env file instead, without success. What...
Read more >Why does testing datasources from admin console fail ... - IBM
BPM deployment environment creation use "WAS_INSTALL_ROOT" variable while defining the data source at a cell level and cluster level.
Read more >Testing with Node, Jest, and JSDOM - Manning Publications
In this article, you'll learn how to use Node and Jest to test code written ... By using passing the value "jsdom" to...
Read more >Environment Variables in Next.js - Frontend Digest
The environment variable is not yet defined on the client, so undefined gets logged instead. You'll notice that the browser will log undefined...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I do see the logic in
index.js
is wrong, I need to include Mirage duringdevelopment
build even ifenabled: false
is specified, precisely for this reason.To get around this for now, remove the
enabled: false
option from your default config, and either useember test --server
, or add a blank file under/server/proxies
or pass the--proxy
option. (You can remove theenabled: true
line as well, it’s enabled by default).My app is on ember 2.5.3 - i did add
server
to .jshintrc in home folder and then intests
folder also, inpredef
section