Skip to content

Commit

Permalink
Merge pull request #16393 from Draggha/test-output-cleanup
Browse files Browse the repository at this point in the history
[CLEANUP beta] #16391 Cleaning up the test output
  • Loading branch information
rwjblue authored Mar 24, 2018
2 parents ba72780 + b1e3cac commit 9da6134
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions packages/ember-metal/tests/libraries_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

let libs, registry;
let originalWarn = getDebugFunction('warn');
function noop() {}

moduleFor('Libraries registry', class extends AbstractTestCase {
beforeEach() {
Expand Down Expand Up @@ -33,6 +34,8 @@ moduleFor('Libraries registry', class extends AbstractTestCase {
['@test only the first registration of a library is stored'](assert) {
assert.expect(3);

// overwrite warn to supress the double registration warning (see https://github.com/emberjs/ember.js/issues/16391)
setDebugFunction('warn', noop);
libs.register('magic', 1.23);
libs.register('magic', 2.23);

Expand Down
5 changes: 2 additions & 3 deletions packages/ember-testing/lib/helpers/pause_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@module ember
*/
import { RSVP } from 'ember-runtime';
import { assert } from 'ember-debug';
import { assert, info } from 'ember-debug';

let resume;

Expand Down Expand Up @@ -57,8 +57,7 @@ export function resumeTest() {
@public
*/
export function pauseTest() {
// eslint-disable-next-line no-console
console.info('Testing paused. Use `resumeTest()` to continue.');
info('Testing paused. Use `resumeTest()` to continue.');

return new RSVP.Promise((resolve) => {
resume = resolve;
Expand Down
13 changes: 12 additions & 1 deletion packages/ember-testing/tests/helpers_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import {
registerWaiter,
unregisterWaiter
} from '../test/waiters';
import { getDebugFunction, setDebugFunction } from 'ember-debug';

var originalInfo = getDebugFunction('info');
var noop = function(){};

function registerHelper() {
Test.registerHelper('LeakyMcLeakLeak', () => {});
Expand Down Expand Up @@ -889,7 +893,10 @@ if (!jQueryDisabled) {
});

moduleFor('ember-testing: debugging helpers', class extends HelpersApplicationTestCase {

afterEach() {
setDebugFunction('info', originalInfo);
}

constructor() {
super();
this.runTask(() => {
Expand All @@ -899,6 +906,8 @@ if (!jQueryDisabled) {

[`@test pauseTest pauses`](assert) {
assert.expect(1);
// overwrite info to supress the console output (see https://github.com/emberjs/ember.js/issues/16391)
setDebugFunction('info', noop);

let {application: {testHelpers: {andThen, pauseTest}}} = this;
andThen(() => {
Expand All @@ -915,6 +924,8 @@ if (!jQueryDisabled) {

[`@test resumeTest resumes paused tests`](assert) {
assert.expect(1);
// overwrite info to supress the console output (see https://github.com/emberjs/ember.js/issues/16391)
setDebugFunction('info', noop);

let {application: {testHelpers: {pauseTest, resumeTest}}} = this;

Expand Down

0 comments on commit 9da6134

Please sign in to comment.