Skip to content
Ultra-simple testing framework without dependencies. Supports async cases.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
index.d.ts
index.js
package.json
screenshot.png
test.js

README.md

micro-should

Ultra-simple testing framework without dependencies. Supports async cases.

Works with any assertion library.

npm install micro-should

Usage

const {should} = require("micro-should");

// Built-in node.js assertion lib.
// You can use any other library, like Chai.js or Expect.js.
const assert = require("assert");

should("add two numbers together", () => {
  assert.equal(2 + 2, 4);
});

should("catch errors", () => {
  assert.throws(() => { throw new Error("invalid"); });
});

should("produce correct promise result", async () => {
  const fs = require("fs").promises;
  const data = await fs.readFile("README.md", "utf-8");
  assert.ok(data.includes("Minimal testing"));
});

// should.only("execute only one test", () => {
//   assert.ok(true);
// });

// should.skip("disable one test by using skip", () => {
//   assert.ok(false); // would not execute
// })

// Execute this at the end of a file.
should.run();

License

MIT (c) Paul Miller (https://paulmillr.com), see LICENSE file.

You can’t perform that action at this time.