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

fartest

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fartest

A minimal, colorful and enjoyable test library for small applications

  • 1.0.1
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

FarTest

FAst and smaRT TESTing

FarTest is a minimal, colorful and enjoyable test library for small applications.

Installation

npm install --save-dev fartest

In short :

npm i -D fartest

Basic usage

FarTest export three functions :

  • starTest - start a new test,
  • stage - define the current stage inside a test,
  • test - check an assertion inside a test.

First, let's import the functions we need :

const {starTest, stage, test} = require('FarTest')

With ES modules :

import {starTest, stage, test} from 'FarTest')

Then, we start the test :

// the name of the function (MyAwesomeTest) is the name of the test
// and is optional
starTest(async function MyAwesomeTest() {

  // we define the current stage of our test
  stage('Some succesful tests')
  test(1 == 1)  // simple assertion
  test(21, 21)  // same as test(21 === 21)

  stage('A simple test which will not succeed')
  test(21, "21")  // will fail because types don't match

  stage('Crash test')
  undefined.coco = 321321  // any invalid code will be caught
})

Running multiple tests

You can run multiple tests at once, in which case they will be executed one after another :

// test 1
starTest(async function CoolTest() {
  stage('1 == 1')
  test(1 == 1)

  stage('2 == "2"')
  test(2 == "2")
})

// test 2
starTest(async function SuperCoolTest() {
  stage('3 == 3')
  test(3 == 3)
})

That's all...

Let's FarT!

Keywords

FAQs

Package last updated on 03 Sep 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc