toml-it
v1.0.4
Published
[](https://www.npmjs.com/package/toml-it) [](https://github.com/CodeWork
Maintainers
Readme
toml-it
toml-it it a simple integration tests runner. It tests the output of a node program.
How to install?
npm i -D toml-itHow to write a test?
Tests files must match the following pattern **/*.spec.toml.
The structure of a tests should be:
stdout=""
description=""
args=""Run tests
If you are using jest as test runner, you can simply create a file toml-it.spec.ts and enter the following code:
import { TestRunner } from "toml-it";
describe('integration tests with toml', () => {
it('toml it', () => {
new TestRunner().run();
});
});Then add the following command in your package.json:
"scripts": {
...,
"test:integration": "tsc; jest",
},Example
If you want to test the following production code:
if (process.argv.length === 3) {
console.log("ok");
} else {
console.log("not ok");
}You now could write two files:
notok.spec.toml
stdout = "not ok"
args = "argument_1 argument_2 argument_3"
description="Should display 'not ok'"ok.spec.toml
stdout = "ok"
args = "argument_1"
description="Should display 'ok'"