BackstopJS
BackstopJS copied to clipboard
Use any config files: backstop.json, backstop.js - Version 2
Use any config files: backstop.json, backstop.js whichever is found first.
Discussion here: https://github.com/garris/BackstopJS/issues/1482
Changes:
- by default look for
backstop.js
orbackstop.json
- adjusted the
init
function to handle properly the initialization- also added the option to init with --js flag
- updated readme
I am not inclined to add another file format generation to
init
-- I don't think this moves the objectives forward.
@garris
Imo I think this project should switch from .json
to .js
config file. We'll keep the "backward" compatibility through the require
feature.
So, my proposal would be:
- we keep the config as it is, this will work for both
.json
and.js
-
init
will generate a.js
file by default - so almost going back to the current code - we update the documentation so that
.js
is by default used - old projects that use the
.json
format will still work. - everybody's happy and this would be a "evolution"
Any consideration for using https://github.com/cosmiconfig/cosmiconfig? It might be nice to offload the work to a separate well-tested, fully-featured library and allow backdrop to give end-users the flexibility that they might expect coming from other ecosystem packages that use cosmiconfig.
@garris @klodoma Just wondering if any version of this solution can be merged.
@maxfenton I would be willing to merge a PR for just this change. It opens up possibilities with the lightest touch.
@garris That would be the second PR.
I didn't hat time anymore I'll have a second look and let you know.
I just made the change. Hope this is helpful. Will go out in next release. https://github.com/garris/BackstopJS/commit/944884bcd785a3cd0715a90371eb39a62855ec58