toml-it
v1.0.4
Published
[![npm package](https://img.shields.io/github/package-json/v/CodeWorksFrance/toml-it)](https://www.npmjs.com/package/toml-it) [![Node.js CI](https://github.com/CodeWorksFrance/toml-it/actions/workflows/nodejs-ci.yml/badge.svg)](https://github.com/CodeWork
Downloads
13
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-it
How 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'"