
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
const chaiExec = require("chai-exec");
const chai = require("chai");
chai.use(chaiExec);
describe("My CLI", () => {
it("should exit with a zero exit code", () => {
// Run your CLI
let myCLI = chaiExec('my-cli --arg1 --arg2 "some other arg"');
// Should syntax
myCLI.exitCode.should.equal(0);
myCLI.should.have.exitCode(0);
myCLI.should.exit.with.code(0);
myCLI.should.exit.with.a.code.that.is.below(1);
myCLI.should.have.an.exit.code.of.at.least(0);
// Expect sytnax
expect(myCLI.exitCode).to.equal(0);
expect(myCLI).to.have.exitCode(0);
expect(myCLI).to.exit.with.code(0);
expect(myCLI).to.exit.with.a.code.that.is.below(1);
expect(myCLI).to.have.an.exit.code.of.at.least(0);
// Assert syntax
assert.equal(myCLI.exitCode, 0);
assert.exitCode(myCLI, 0);
assert.notExitCode(myCLI, 1);
assert.exitCodeBetween(myCLI, 0, 1);
});
});
Install using npm:
npm install chai-exec
Then require it in your test file and register it with Chai:
const chaiExec = require("chai-exec");
const chai = require("chai");
chai.use(chaiExec);
Contributions, enhancements, and bug-fixes are welcome! File an issue on GitHub and submit a pull request.
To build/test the project locally on your computer:
Clone this repo
git clone hhttps://github.com/JS-DevTools/chai-exec.git
Install dependencies
npm install
Run the tests
npm test
chai-exec is 100% free and open-source, under the MIT license. Use it however you want.
Thanks to these awesome companies for their support of Open Source developers ❤
FAQs
Chai assertions for testing your CLI
The npm package chai-exec receives a total of 50 weekly downloads. As such, chai-exec popularity was classified as not popular.
We found that chai-exec demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.