MiniSpec is a test/spec execution engine. It works out-of-the box with TypeScript, ECMAScript (esm) and CommonJS (cjs) modules. It uses the BDD/Spec syntax: describe, context and it.

npm install --save-dev minispec
added 1 package, and audited 2 packages in 2s
// minispec_entrypoint.mjs

import assert from 'assert'
import MiniSpec, { describe, it } from 'minispec'

function sayHello(): string {
  return 'Hello, world!'
}

describe('MiniSpec', async () => {
  it('says "Hello, world!"', async () => {
    assert.equal('Hello, world!', sayHello())
  })
})

MiniSpec.execute()
node minispec_entrypoint.mjs
MiniSpec
  says "Hello, world!"

Finished in 9 milliseconds (discovering took 7 milliseconds, execution took 2 milliseconds)
1 test, no failure 👏

Why another test/spec execution engine?

The idea of MiniSpec cames from the need to write some unit-tests for a tiny library written in TypeScript. All testing framework were pretty big - with a lot of dependencies - and may not work well out-of-the-box with TypeScript.

MiniSpec goal is to remain lightweight, without runtime dependency. Its main purpose is to add a bunch of tests to small JavaScript or TypeScript projects.

Its name comes from the combination of minitest, and RSpec. Minitest for the idea of having a small and easy to maintain test/spec engine. RSpec for the spec syntax and for some output formats.

Why does weight matter?

Less dependencies and a lightweight library means less resources consumed while downloading it and executing it. It also reduces the potential attack surface.

That means also fewer features. That is why MiniSpec purpose is to be used with small projects, which do not need advanced testing capabilities that may offer more popular alternatives.

Last news