Skip to content

Commit

Permalink
Merge pull request #322 from stefanpenner/memoize-custom-tree
Browse files Browse the repository at this point in the history
ensure custom tree is still memoized
  • Loading branch information
Turbo87 authored Apr 6, 2019
2 parents d287531 + bfbf116 commit 449706c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* eslint-env node */

const VersionChecker = require('ember-cli-version-checker');
const cacheKeyForTree = require('calculate-cache-key-for-tree');

module.exports = {
name: 'ember-test-selectors',
Expand Down Expand Up @@ -74,6 +75,15 @@ module.exports = {
}
},

cacheKeyForTree(treeType) {
// ensure our treeForAddon is memoized
if (treeType === 'addon') {
return cacheKeyForTree('addon', this, [this._stripTestSelectors]);
} else {
return cacheKeyForTree(treeType, this);
}
},

treeForAddon() {
// remove our "addon" folder from the build if we're stripping test selectors
if (!this._stripTestSelectors) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"test:strip": "STRIP_TEST_SELECTORS=true ember test"
},
"dependencies": {
"calculate-cache-key-for-tree": "^1.1.0",
"ember-cli-babel": "^6.8.2",
"ember-cli-version-checker": "^3.1.3"
},
Expand Down

0 comments on commit 449706c

Please sign in to comment.