Skip to content

Requirements should be configured in package.json #1132

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

Closed
igl opened this issue Nov 28, 2016 · 7 comments
Closed

Requirements should be configured in package.json #1132

igl opened this issue Nov 28, 2016 · 7 comments
Labels

Comments

@igl
Copy link

igl commented Nov 28, 2016

✖ The --require and -r flags are deprecated. Requirements should be configured in package.json - see documentation.

Is there a particular reason for this?

This pains me:

  • I am less flexible now on how to run ava in my project. Unit tests for frontend/backend may have different requirements.
  • I kept my package.json clean so far. Now i am forced to put ava fluff in there.
  • Configuration does not belong in there in the first place IMO.
  • CLI-flags can be removed all the way now since i am not going to put ava options in 2 different places.

#1048 looks like api-bikeshed but there is no technical reasoning.

@sindresorhus
Copy link
Member

CLI-flags can be removed all the way now since i am not going to put ava options in 2 different places.

Yes, that's the motivation. Having it in package.json makes it easier for external tools, like editor plugins, to use the same config.

@igl
Copy link
Author

igl commented Nov 30, 2016

Removing flexibility to a static "one config per package.json" seems pointless to me. You could still have both and the "static (pkg) > overwrites (cli)" model seems more reasonable to me.

@werme
Copy link

werme commented Jan 10, 2017

Is there any way to have different requirements for different entry points within the same project with the current configuration model?

@igl
Copy link
Author

igl commented Jan 11, 2017

2 package.json files as far as i understood.

@AutoSponge
Copy link

I'm running into an issue with this decision. While using zeit/micro for a server, which uses async-to-gen, I don't get accurate coverage data when using:

"require": [
  "async-to-gen/register"
]

However, the tests run fine. If I want accurate coverage (from nyc), I have to go to latest node version and remove the require config. However, my build server can not be upgraded to latest yet. I'd like to have ava run tests under a cli switch and keep require out of my config so I can run coverage locally.

@novemberborn
Copy link
Member

@AutoSponge I'd write a little wrapper module that checks the Node.js version and requires async-to-gen/register if it doesn't support async/await.

@AutoSponge
Copy link

@novemberborn great idea. This worked for me.

if (!require('is-async-supported')()) {
  require('async-to-gen/register')
}

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

No branches or pull requests

6 participants