You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For integration into ci chains it would be great to be able to pass the configuration via stdin to the backstop command which would allow to create the configuration on the fly in non js environments.
I already tried to use /dev/stdin which theoretically could work via someCustomScript | backstop test --config=/dev/stdin but ran into the problems below.
BackstopJS v5.0.7
Loading config: /dev/stdin
/dev/fd/0:2
"id": "Vendor_Site",
^
SyntaxError: Unexpected token ':'
at wrapSafe (internal/modules/cjs/loader.js:1070:16)
at Module._compile (internal/modules/cjs/loader.js:1120:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at loadProjectConfig (/Users/MFI/.nvm/versions/node/v12.16.2/lib/node_modules/backstopjs/core/util/makeConfig.js:46:20)
at makeConfig (/Users/MFI/.nvm/versions/node/v12.16.2/lib/node_modules/backstopjs/core/util/makeConfig.js:62:38)
at module.exports (/Users/MFI/.nvm/versions/node/v12.16.2/lib/node_modules/backstopjs/core/runner.js:5:16)
The same command works when used with temporary files someCustomScript > backstop.json && backstop test --config=backstop.json but it would be really good to avoid the temporary file.
The text was updated successfully, but these errors were encountered:
mficzel
changed the title
Pass config via stdin
Pass configuration via stdin
Dec 9, 2020
Yup. You're not the first one to want this -- unfortunately the CLI really just wants a file. You could totally submit a PR to enhance that -- but it's a few hours of work. Instead -- it might just be easier to wrap the backstop module in a node script. Because you can totally pass in a string for the config at a module level. That is probably more like 30 mins of work max. There are node examples in the docs and you can check the /tests directory for a starter template.
Then you can pass literals from your command line to your node script which calls BackstopJS in the node world and passes the literal. Hope that helps.
If you decide to do it then please LMK. Would be great to add it to the project as an example or template.
Will look into it further. No clue wether i will achieve anything as my native language is php. Will take some time as integrating backstop into our ci is more like a long term project.
For integration into ci chains it would be great to be able to pass the configuration via stdin to the backstop command which would allow to create the configuration on the fly in non js environments.
I already tried to use /dev/stdin which theoretically could work via
someCustomScript | backstop test --config=/dev/stdin
but ran into the problems below.The same command works when used with temporary files
someCustomScript > backstop.json && backstop test --config=backstop.json
but it would be really good to avoid the temporary file.The text was updated successfully, but these errors were encountered: