How to use the qunit.testDone function in qunit

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

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emberjs / ember-test-helpers / tests / test-helper.js View on Github external
let deprecations;
registerDeprecationHandler((message, options, next) => {
  // in case a deprecation is issued before a test is started
  if (!deprecations) {
    deprecations = [];
  }

  deprecations.push(message);
  next(message, options);
});

QUnit.testStart(function() {
  deprecations = [];
});

QUnit.testDone(function({ module, name }) {
  run.backburner.DEBUG = true;
  // this is used to ensure that no tests accidentally leak `Ember.testing` state
  if (Ember.testing) {
    let message = `Ember.testing should be reset after test has completed. ${module}: ${name} did not reset Ember.testing`;
    cleanupFailures.push(message);

    // eslint-disable-next-line
    console.error(message);
    Ember.testing = false;
  }

  // this is used to ensure that the testing container is always reset properly
  let testElementContainer = document.getElementById('ember-testing-container');
  let actual = testElementContainer.innerHTML;
  let expected = `<div id="ember-testing"></div>`;
  if (actual !== expected) {
github brzpegasus / ember-cli-nwjs / test-support / node-webkit / qunit-logger.js View on Github external
if (params.result !== true) {
        var actualTestCount = results.total + 1;
        log('not ok ' + actualTestCount + ' - ' + params.module + ' - ' + params.name);
      }

  })
  QUnit.testStart( function(params){
      currentTest = {
          id: id++,
          name: (currentModule ? currentModule + ': ' : '') + params.name,
          items: []
      }
      socket.emit('tests-start')
  })
  QUnit.testDone( function(params){
      currentTest.failed = params.failed
      currentTest.passed = params.passed
      currentTest.total = params.total

      results.total++
      if (currentTest.failed > 0)
          results.failed++
      else
          results.passed++

      results.tests.push(currentTest)

      if (params.failed === 0) {
        results.tests[params.name] = params.name;
        log('ok ' + results.total + ' - ' + params.module + ' # ' + params.name);
      }
github emberjs / ember-qunit / addon-test-support / ember-qunit / index.js View on Github external
export function setupResetOnerror() {
  QUnit.testDone(resetOnerror);
}
github Addepar / ember-table / tests / test-helper.js View on Github external
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';
import QUnit from 'qunit';
import {
  setup as setupWarnHandlers,
  teardown as teardownWarnHandlers,
} from './helpers/warn-handlers';

registerRAFWaiter();
setApplication(Application.create(config.APP));

QUnit.testStart(() => {
  setupWarnHandlers();
});

QUnit.testDone(() => {
  teardownWarnHandlers();
});

start();
github emberjs / ember-qunit / addon-test-support / ember-qunit / index.js View on Github external
export function setupEmberTesting() {
  QUnit.testStart(() => {
    Ember.testing = true;
  });

  QUnit.testDone(() => {
    Ember.testing = false;
  });
}