Sha256: fd6052ac9da8d66e5e1b48aeafd7b2cc66f3f2360f6e1734d4b5b1005e6c789f

Contents?: true

Size: 969 Bytes

Versions: 3

Compression:

Stored size: 969 Bytes

Contents

export default function setupQUnit(assertion, _qunitGlobal) {
    let qunitGlobal = QUnit;
    if (_qunitGlobal) {
        qunitGlobal = _qunitGlobal;
    }
    let originalModule = qunitGlobal.module;
    qunitGlobal.module = function (name, _options) {
        let options = _options || {};
        let originalSetup = options.setup || options.beforeEach || function () { };
        let originalTeardown = options.teardown || options.afterEach || function () { };
        delete options.setup;
        delete options.teardown;
        options.beforeEach = function () {
            assertion.reset();
            assertion.inject();
            return originalSetup.apply(this, arguments);
        };
        options.afterEach = function () {
            let result = originalTeardown.apply(this, arguments);
            assertion.assert();
            assertion.restore();
            return result;
        };
        return originalModule(name, options);
    };
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/internal-test-helpers/lib/ember-dev/setup-qunit.js
discourse-ember-source-3.5.1.1 dist/es/internal-test-helpers/lib/ember-dev/setup-qunit.js
discourse-ember-source-3.5.1.0 dist/dist/es/internal-test-helpers/lib/ember-dev/setup-qunit.js