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

Enable loading multiple --require-main scripts #136

Merged
merged 1 commit into from
Apr 1, 2019
Merged

Enable loading multiple --require-main scripts #136

merged 1 commit into from
Apr 1, 2019

Conversation

pronebird
Copy link
Contributor

@pronebird pronebird commented Mar 29, 2019

This PR fixes the artificial constraint put on --require-main which previously would only load the given script if only one --require-main argument is given.

This behaviour is confusing because it would do nothing when providing two scripts via --require-main and misleading at best. In contrast, the --require argument allows for multiple scripts to be provided.

The rationale behind loading multiple scripts is to preload Babel or TypeScript transpilers to be able to run modern JavaScript as preload scripts.

In my case, I use one script for the main electron process in order to turn off logging to file for the tested components (I use electron-log) and in the renderer process I do preload Chai extensions and configure Enzyme.

cross-env NODE_ENV=test electron-mocha --renderer 
--reporter spec 
--require ts-node/register 
--require "test/setup/renderer.ts"
--require-main ts-node/register 
--require-main "test/setup/main.ts" 
"test/*.spec.tsx"

@inukshuk inukshuk merged commit d51062d into jprichardson:master Apr 1, 2019
@inukshuk
Copy link
Collaborator

inukshuk commented Apr 1, 2019

Looks good, thanks!

@pronebird pronebird deleted the patch-1 branch April 1, 2019 11:07
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

Successfully merging this pull request may close these issues.

None yet

2 participants