Skip to content

Commit

Permalink
feat(warnings in tests) don't strip warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kybishop committed Aug 24, 2017
1 parent b32c61f commit a76eafb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
language: node_js
node_js:
- "4"
- "6"

sudo: false
dist: trusty
Expand Down
3 changes: 1 addition & 2 deletions addon/-debug/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Ember from 'ember';
const { Logger } = Ember;

export function assert(msg, conditional) {
if (!conditional) {
Expand All @@ -8,7 +7,7 @@ export function assert(msg, conditional) {
}

export function debug() {
Logger.debug(...arguments);
Ember.Logger.debug(...arguments);
}

export function debugOnError(msg, conditional) {
Expand Down
34 changes: 16 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-env node */
'use strict';

const StripClassCallCheck = require('babel6-plugin-strip-class-callcheck');
const FilterImports = require('babel-plugin-filter-imports');
const RemoveImports = require('./lib/babel-plugin-remove-imports');
const Funnel = require('broccoli-funnel');
const RemoveImports = require('./lib/babel-plugin-remove-imports');
const StripClassCallCheck = require('babel6-plugin-strip-class-callcheck');

module.exports = {
name: 'ember-attacher',
Expand All @@ -22,24 +22,24 @@ module.exports = {
return;
}

if (/production/.test(env) || /test/.test(env)) {
var strippedImports = {
'ember-attacher/-debug/helpers': [
'assert',
'debug',
'debugOnError',
'stripInProduction'
]
};

if (/production/.test(env)) {
// In some versions of Ember, this.options is undefined during tests
this.options = this.options || {};

// Make sure the babel options are accessible
let babelOptions = this.options.babel = this.options.babel || {};
const babelOptions = this.options.babel = this.options.babel || {};

babelOptions.plugins = babelOptions.plugins || [];
babelOptions.postTransformPlugins = babelOptions.postTransformPlugins || [];

const strippedImports = {
'ember-attacher/-debug/helpers': [
'assert',
'debug',
'debugOnError',
'stripInProduction'
]
};
babelOptions.plugins.push([FilterImports, strippedImports]);
babelOptions.plugins.push([RemoveImports, 'ember-attacher/-debug/helpers']);
babelOptions.postTransformPlugins.push(StripClassCallCheck);
Expand All @@ -48,13 +48,11 @@ module.exports = {
this._hasSetupBabelOptions = true;
},

treeForAddon: function() {
var tree = this._super.treeForAddon.apply(this, arguments);

if (/production/.test(this._env) || /test/.test(this._env)) {
treeForAddon: function(tree) {
if (/production/.test(this._env)) {
tree = new Funnel(tree, { exclude: [ /-debug/ ] });
}

return tree;
return this._super.treeForAddon.call(this, tree);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
  \{{
<span class="underlined">
#ember-attacher
{{#ember-attacher popperClass="ember-attacher-popper tooltip"}}
{{#ember-attacher popperClass="ember-attacher-popper ember-attacher-tooltip"}}
{{#if isConfiguringTooltip}}
The "Tooltip in a parent" ember-attacher is initially set to the default settings.
Twiddle some knobs to see what ember-attacher can do!
Expand Down

0 comments on commit a76eafb

Please sign in to comment.