
Security News
Node.js TSC Votes to Stop Distributing Corepack
Corepack will be phased out from future Node.js releases following a TSC vote.
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
Corepack will be phased out from future Node.js releases following a TSC vote.
Research
Security News
Research uncovers Black Basta's plans to exploit package registries for ransomware delivery alongside evidence of similar attacks already targeting open source ecosystems.
Security News
Oxlint's beta release introduces 500+ built-in linting rules while delivering twice the speed of previous versions, with future support planned for custom plugins and improved IDE integration.