Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env passed to config/polly.js is development when tests are executed via ember exam #489

Open
azhiv opened this issue Nov 2, 2023 · 0 comments

Comments

@azhiv
Copy link

azhiv commented Nov 2, 2023

Description

env passed to config/polly.js is development when tests are executed via ember exam. ember-exam allows to split tets in chunks and/or run them in parallel.

config/polly.js:

module.exports = function(env) {
  return {
    // Addon Configuration Options
    enabled: env === 'test',

    // Server Configuration Options
    server: {
      apiNamespace: '/polly',
      recordingsDir: 'recordings',
    },
  };
};
ember exam --parallel=2 --load-balance

Error Message & Stack Trace

There's no error message but rather the behaviour is incorrect - polly doesn't get initialized. I added console.log('env :>> ', env); in the beginning of the file and it prints development. Adding EMBER_ENV seems to fix the problem, however it is not documented and intuitively shouldn't be needed at all when running tests.

Dependencies

{
    "@pollyjs/adapter": "6.0.6",
    "@pollyjs/adapter-fetch": "6.0.6",
    "@pollyjs/adapter-xhr": "6.0.6",
    "@pollyjs/core": "6.0.6",
    "@pollyjs/ember": "6.0.6",
    "@pollyjs/node-server": "6.0.6",
    "@pollyjs/persister": "6.0.6",
    "@pollyjs/persister-local-storage": "6.0.6",
    "@pollyjs/persister-rest": "6.0.6",
    "@pollyjs/utils": "6.0.6",
}

Your determineEnv is very fragile and assumes the app is executed with predefined arguments. Why don't you integrate into Ember workflow to pull the exact environment from the app config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant