fran-testing-library

1.0.10 • Public • Published

Getting Started

Install fran-testing-library using npm

npm install fran-testing-library

Fran testing library does not need any configuration to start.

Let's start by writing a test for a function that adds two numbers. First, create a sum.js file:

function sum(a, b) {
  return a + b;
}
module.exports = sum;

Then, create a file named sum.test.js. This will contain our actual test:

const sum = require("./sum");

test("adds 1 + 2 to equal 3", () => {
  expect(sum(1, 2)).toBe(3);
});

Add the following section to your package.json:

{
  "scripts": {
    "test": "npx fran"
  }
}

You can also run npx fran directly

Finally, run npm test or npx fran and fran-testing-library will print this message:

PASS  ./sum.test.js
✓ adds 1 + 2 to equal 3 (5ms)

You just successfully wrote your first test using fran-testing-library!

Readme

Keywords

none

Package Sidebar

Install

npm i fran-testing-library

Weekly Downloads

14

Version

1.0.10

License

ISC

Unpacked Size

4.27 kB

Total Files

4

Last publish

Collaborators

  • francescoalterio