Skip to content

Commit befee13

Browse files
author
Robert Jackson
committed
Ensure to squelch intentional warnings in tests.
1 parent 9f01a80 commit befee13

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tests/create-tests.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22

33
const DebugToolsPlugin = require('..');
44
const fs = require('fs');
5+
const CONSOLE = Object.assign({}, console);
56

67
function createTests(options) {
78
const babelVersion = options.babelVersion;
89
const presets = options.presets;
910
const transform = options.transform;
1011

12+
afterEach(function() {
13+
Object.assign(console, CONSOLE);
14+
});
15+
1116
describe('Feature Flags', function() {
1217
const h = transformTestHelper({
1318
presets,
@@ -154,6 +159,10 @@ function createTests(options) {
154159
});
155160

156161
describe('ember-cli-babel default configuration (legacy config API)', function() {
162+
beforeEach(function() {
163+
console.warn = () => {}; // eslint-disable-line
164+
});
165+
157166
let h = transformTestHelper({
158167
presets,
159168
plugins: [

tests/normalize-options-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
const normalizeOptions = require('../src/utils/normalize-options').normalizeOptions;
44

55
describe('normalizeOptions', function() {
6+
let originalConsole = Object.assign({}, console);
7+
8+
afterEach(function() {
9+
Object.assign(console, originalConsole);
10+
});
11+
612
it('converts "old style" options into the newer style (with deprecation)', function() {
13+
let warnings = [];
14+
console.warn = warning => warnings.push(warning); // eslint-disable-line
15+
716
let actual = normalizeOptions({
817
envFlags: {
918
source: '@ember/env-flags',
@@ -39,6 +48,9 @@ describe('normalizeOptions', function() {
3948
};
4049

4150
expect(actual).toEqual(expected);
51+
expect(warnings).toEqual([
52+
'babel-plugin-debug-macros configuration API has changed, please update your configuration',
53+
]);
4254
});
4355

4456
it('sets flag to false when svelte version matches the flag version', function() {

0 commit comments

Comments
 (0)