Socket
Socket
Sign inDemoInstall

chai-baseline

Package Overview
Dependencies
8
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    chai-baseline

File-based baseline testing for chai


Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Install size
32.4 kB
Created
Weekly downloads
 

Readme

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

Last updated on 22 Aug 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc