New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

classity

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

classity

Minimal Test Framework using JavaScript classes

latest
Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

Classity

Minimal Test Framework for NodeJS' modern ECMA Script capabilities:

  • A Test File is named name.test.(c|m)?js in the current directory or a subdirectory, except node_modules.
  • A Test Suite is an exported class, for example (assuming using modules):
// Use node's built-in assertion library.
import assert from 'assert/strict'

// export default class {} is also valid.
export class MyTestSuite {
	static before() {
		// This is called once for each test suite.
		// Can be async.
	}
	constructor() {
		// This is called once for each test
		// because a new instance of this class is created for each test.
		// For sync code can be a replacement for the non-static before method below.
	}
	before() {
		// This is also called once for each test.
		// Can be async.
	}
	test1() {
		// A test
	}
	async test2() {
		// Another test, note that one or more methods can be async
		// except for the constructor.
	}
	after() {
		// This is called once after each test.
		// Can be async.
	}
	static after() {
		// This is called once after each test suite.
		// Can be async.
	}
}

Usage

Install with npm i --save-dev classity. Run once with npx classity or start a watcher with npx classity watch.

Credits

I wanted a simple test framework like teenytest but wanted to use Classes and Promises by default.

Keywords

async

FAQs

Package last updated on 16 Sep 2021

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