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

Support custom test runner environment variables #17902

Merged
merged 6 commits into from Aug 22, 2018

Conversation

Projects
None yet
1 participant
@smashwilson
Member

smashwilson commented Aug 22, 2018

To generate Istanbul test coverage data for atom/github from the graphical test runner, we need to have ATOM_GITHUB_BABEL_ENV set to "coverage". This activates a Babel environment that includes "babel-plugin-istanbul" that installs instrumentation into the transpiled source. But, we can't have it set when launching Atom, because the version of atom/github that's bundled with Atom (or, in my case, installed in~/.atom/packages`) doesn't include the plugin, which is a devDependency.

We wouldn't want to activate it for the github package in the host Atom environment, anyway, because the instrumentation has a pretty significant performance cost.

I'm adding an optional parameter to WorkspaceElement::runPackageSpecs() that's eventually used to initialize the AtomWindow. I've also added some code within the test window to pick up and install the environment before running transpilers or anything from the package source.

Here's how I'm using this in my init.js:

atom.commands.add('me:run-package-specs', () => {
  atom.workspace.getElement().runPackageSpecs({
    env: Object.assign({}, process.env, {ATOM_GITHUB_BABEL_ENV: 'coverage'})
  })
})

/cc @annthurium @kuychaco

smashwilson added some commits Aug 22, 2018

@smashwilson smashwilson merged commit cd756ea into master Aug 22, 2018

3 checks passed

VSTS: Atom Pull Requests 20180822.4 succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@smashwilson smashwilson deleted the aw/custom-test-env branch Aug 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment