npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nole

v3.0.0

Published

Testing Library for Typescript projects

Readme

Nole

Nole is a testing platform just like mocha..

Breaking change at nole v3, plain old classes are better at this task.

Use nole 2.x for ESM and Typescript.

Use nole 1.x for CommonJS. (ability to disable Typescript with -T option)

// test/queue.test.ts
import { Test } from "nole";

export class QueueTest extends Test() {
  queue!: Queue;

  createInstance() {
    this.queue = new Queue();
  }

  push() {
    this.queue.push(10);
  }

  async pipe() {
    await this.queue.pipe(somewhere);
  }
}
$ nole ./test/**/*.test.ts
  (ok)      0.09 ms QueueTest.createInstance()
  (ok)      0.11 ms QueueTest.push()
  (ok)      1.09 ms QueueTest.pipe()

Skip

You can skip tests. Make sure method name starts with skip

// test/queue.test.ts
import { Test } from "nole";

export class QueueTest extends Test() {
  skip_Push() {
    this.queue.push(10);
  }
}
$ nole ./**/test/*.test.ts
  (skip)              QueueTest.skip_Push() {marked as skipped}
// test/queue.test.ts
import { Test } from "nole";

export class QueueTest extends Test({
  skip: "no need",
}) {
  push() {
    this.queue.push(10);
  }
}
$ nole ./**/test/*.test.ts
  (skip)              QueueTest.skip_Push() {no need}

Dependencies

You can include other tests and wait them to complete.

// test/database.test.ts
import { Test } from "nole";

export class Database extends Test() {
  connection!: any;

  async connect() {
    connection = new Connection("...");

    await connection.connect();
  }
}
// test/other.test.ts
import { Test } from "nole";
import { Database } from "./database.test";

export class Other extends Test({
  dependencies: {
    database: () => Database,
  },
}) {
  async DoThings() {
    await this.database.connection.doStuff();
  }
}
  • All dependencies will be waited until done
  • If dependencies cannot resolve, it will occurr an error after the available tests done.

Wait other tests

// test/redis.test.ts
import { Test } from "nole";

export class A extends Test() {
  async doThings() {}
}

export class B extends Test({ before: () => [A] }) {
  async doThings() {}
}

Hook

Hooks will help you to develop helper methods.

// test/hook.test.ts
import { Test } from "nole";

export class HookTest {
  value!: number;

  async beforeEach() {
    this.value = Math.random();
  }

  validateNumber() {
    if (this.value > 0.5) {
      throw new Error("Should not be higher than 0.5");
    }
  }
}

Dynamic Tests

// test/dynamic.test.ts
import { Test, addTest } from "nole";

// not exported, nole cannot auto-bind this class
class DynamicTest extends Test() {
  test() {}
}

// adds it anyway
addTest(() => DynamicTest);
// test/dynamic2.test.ts
import { Test, addTest } from "nole";

if (something) {
  addTest(
    () =>
      class Special extends Test() {
        check() {}
      },
  );
}
// test/dynamic3.test.ts
import { Test, addTest } from "nole";

export class DeepTest extends Test() {
  check() {
    if (something) {
      addTest(() => class Wololo extends Test() {});
    }
  }
}

Test cleanup

There is a special hook that can be used to capture test finishing stage.

Lifecycle:

  • (class) Before
    • (method) BeforeEach
    • (method) Spec
    • (method) AfterEach
  • (class) After
  • (class) CleanUp *called after dependency execution
// test/database-with-cleanup.test.ts
import { Test } from "nole";

export class DatabaseWithCleanup extends Test() {
  connection!: any;

  async connect() {
    this.connection = new Connection("...");

    await connection.connect();
  }

  async cleanUp() {
    this.connection.close();
    console.log("Connection closed!");
  }
}
// test/other.test.ts
import { Test } from "nole";
import { Database } from "./database.test";

export class Other extends Test({
  dependencies: {
    database: () => DatabaseWithCleanup,
  },
}) {
  async doThings() {
    await this.database.connection.doStuff();
  }
}
$ nole ./test/**/*.test.ts
  (ok)      0.09 ms DatabaseWithCleanup.connect()
  (ok)      0.11 ms Other.doThings()
Connection closed!

Test extending

If they are classes we should be able to extend them right

// test/extending.test.ts
import { Test } from "nole";

// Simple is not exported, so nole wont handle it
class Simple extends Test() {
  value = 1;

  check() {
    if (this.value !== 1) {
      // yeah it should be 1 anyway
    }
  }
}

export class Complex extends Simple {
  check() {
    if (this.value > 0) {
      // maybe it is more than just 1?
    }

    super.check(); // or
  }
}

export class MoreComplex extends Simple {
  moreSpecs() {
    // mooree
  }
}
$ nole ./test/**/*.test.ts
  (ok)      0.09 ms Complex.check()
  (ok)      0.11 ms MoreComplex.check()
  (ok)      0.11 ms MoreComplex.moreSpecs()