Skip to content

Instantly share code, notes, and snippets.

@NoriSte
Last active August 22, 2019 14:33
Show Gist options
  • Save NoriSte/0900e44b1a5e7854eb2f1c254eb26763 to your computer and use it in GitHub Desktop.
Save NoriSte/0900e44b1a5e7854eb2f1c254eb26763 to your computer and use it in GitHub Desktop.
NPM as a project depenency

Running node index.js is the same of running npm run cy:run --record --key <YOUR_RECORDING_KEY>.

I used it here to make the npm run dynamic without changing the way I managed it.

const npm = require("npm")
npm.load(() => {
npm["run-script"]([
"cy:run",
"--record",
"--key",
"<YOUR_RECORDING_KEY>"
])
});
{
"scripts": {
"cy:run": "cypress run"
},
"devDependencies": {
"cypress": "^3.4.1",
"npm": "^6.10.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment