Skip to content

Commit

Permalink
Merge pull request #10 from kashiif/ember-2.4-support
Browse files Browse the repository at this point in the history
Fix #9: Support ember LTS 2.4.x and node older versions
  • Loading branch information
kylemellander authored Dec 5, 2016
2 parents 221a292 + c427d2d commit abfb874
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
/* jshint node: true */
'use strict';

var path = require('path');
var Funnel = require('broccoli-funnel');

module.exports = {
name: 'ember-test-with-data',
included(app) {
included: function(app) {
var registry = app.registry;
var options = app.options || {};
this.env = app.env;

var configPath = options.configPath;

if (!this.env || !configPath) { return; }

// NOTE: For ember-cli >= 2.6.0-beta.3, project.configPath() returns absolute path
// while older ember-cli versions return path relative to project root
if (!path.isAbsolute(configPath)) {
configPath = path.join(app.project.root, configPath);
}

var config = require(configPath)(this.env) || {};
var addonSettings = config['ember-test-with-data'] || {};
this.hiddenEnvironments = addonSettings['hiddenEnvironments'] || ['production'];
Expand All @@ -27,9 +36,9 @@ module.exports = {
}
},

treeForAddon() {
treeForAddon: function() {
var tree = this._super.treeForAddon.apply(this, arguments);
const hiddenEnvironments = this.hiddenEnvironments || ['production'];
var hiddenEnvironments = this.hiddenEnvironments || ['production'];
if (hiddenEnvironments.indexOf(this.env) !== -1) {
this.ui.writeLine('Stripping all data test attributes');
tree = new Funnel(tree, { exclude: [ /add-data-test-to-view/ ] });
Expand Down

0 comments on commit abfb874

Please sign in to comment.