How to use the unexpected.installPlugin function in unexpected

To help you get started, we’ve selected a few unexpected examples, based on popular ways it is used in public projects.

github Lugribossk / simple-dashboard / test / testSetup.js View on Github external
/*global global*/
import jsdom from "jsdom";
import expect from "unexpected";
import unexpectedSinon from "unexpected-sinon";
import sinon from "sinon";

// Set up expected browser globals.
global.document = jsdom.jsdom("<!doctype html><html><head></head><body></body></html>");
global.window = document.defaultView;
global.navigator = {
    userAgent: ""

// Set up Unexpected plugins (on the actual unexpected instance, so they show up when it is imported by other modules).

// Automatically restore Sinon stubs after tests end.
var oldWrap = sinon.wrapMethod;
var wrappeds = [];
var afterSetup = false;
sinon.wrapMethod = function (...args) {
    var out = oldWrap.apply(sinon, args);
    if (!afterSetup) {
        // Delay setting up afterEach since it is not yet defined when this module is run.
        afterEach(() => {
            wrappeds.forEach(wrapped => {
            wrappeds = [];


Extensible BDD assertion toolkit

Latest version published 1 month ago

Package Health Score

81 / 100
Full package analysis

Similar packages