Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove default config file extension
Enables use of js or json based default `backstop` config file.
- Loading branch information
944884b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 944884b (this conversation #1566) I believe this needs to be changed as well:
944884b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may cause issues in the future. commonjs can indeed find the difference between
json
andjs
requires
, however, it will get confused by files that lack extensions.Integration tests are failing due because of this inability to differentiate (without extension):
944884b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garris FWIW... when I saw the
integration-test
error, I did start to unravel how it could be addressed. But we would maybe want to release-candidate and RFC something like this.ChatGPT says:
944884b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgrebb Thank you for looking into this.
Just to be clear -- WRT
config.backstopConfigFileName = path.join(config.projectPath, 'backstop')
The intention is to allow a user to supply a
backstop.json
orbackstop.js
config file (with suffix included). The intention is not to allow a user to supply an un-suffix'dbackstop
config file.I believe per this https://nodejs.org/api/modules.html#file-modules -- require looks for .js and then .json file extensions when an extension is not supplied to the
require()
method.944884b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where it gets tricky is initializing a new project, which will read from the default config value:
and go on to
makeConfig
with that value:and go on to generate an extension-less
backstop
configuration file...The good news is the integration test caught this :) Should we get those integration tests running on
push
to any branch 😉 ?944884b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok -- wow. great catch!
I just reverted the change. I see that the currently running tests don't validate the
init
flow. See, this is why they should revoke my git license. 🤦Sorry, Where are those integration tests you're talking about? I know we looked at them before.