Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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) {
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);
}
export function setupResetOnerror() {
QUnit.testDone(resetOnerror);
}
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();
export function setupEmberTesting() {
QUnit.testStart(() => {
Ember.testing = true;
});
QUnit.testDone(() => {
Ember.testing = false;
});
}