🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

chai-baseline

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-baseline

File-based baseline testing for chai

1.2.0
latest
Source
npm
Version published
Weekly downloads
6
100%
Maintainers
1
Weekly downloads
 
Created
Source

File-based baseline testing for chai.

chai-baseline adds simplified file-based baseline testing for chai. With it you can compare data to a reference file on disk, storing a local file in the process. This allows for the use of large-scale diff tools to do additional comparisons outside of the tests themselves.

Installation

npm install chai-baseline

Usage

chai-baseline can only be used in NodeJS where it has access to the file system.

Usage with expect

// ES6 syntax (TypeScript, Babel)
import { use, expect } from "chai";
import chaiBaseline from "chai-baseline";
use(chaiBaseline);

// pre-ES6 syntax
var chai = require("chai"), expect = chai.expect;
var chaiBaseline = require("chai-baseline").default;
chai.use(chaiBaseline);

// usage
it("baseline", () => {
    const text = "...output text...";
    return expect(text).to.have.baseline("transpilerOutput.txt", { base: "./baselines" }); // returns Promise
});

Usage with assert

// ES6 syntax (TypeScript, Babel)
import { use, assert } from "chai";
import chaiBaseline from "chai-baseline";
use(chaiBaseline);

// pre-ES6 syntax
var chai = require("chai"), assert = chai.assert;
var chaiBaseline = require("chai-baseline").default;
chai.use(chaiBaseline);

// usage
it("baseline", () => {
    const text = "...output text...";
    return assert.baseline(text, "transpilerOutput.txt", { base: "./baselines" }); // returns Promise
});

FAQs

Package last updated on 22 Aug 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