JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q26519F
  • License MIT

Package Exports

  • toml-it
  • toml-it/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (toml-it) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

toml-it

npm package Node.js CI   eslint

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'"