New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

micro-should

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro-should

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

0.1.1
Source
npm
Version published
Weekly downloads
282
-30.2%
Maintainers
1
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 05 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts