Skip to content

Commit

Permalink
Step 1: Move tesselignore resolution ahead of conditional deployment …
Browse files Browse the repository at this point in the history
…path

- Updates tests to correctly reflect the number of glob.sync calls to make.
  • Loading branch information
rwaldron committed Feb 19, 2016
1 parent 5a2b69c commit 84662a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/tessel/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ actions.tarBundle = function(opts) {
return rules;
}, []);

var ignoreRules = actions.glob.rules(target, '.tesselignore').concat(includeNegateRules);
var ignoreFiles = actions.glob.files(globRoot, ignoreRules);

// Both the --slim and --full paths will use a copy of the
// project to bundle. This allows us to be destructive
// with the files, but without directly tampering with the
Expand All @@ -718,8 +721,6 @@ actions.tarBundle = function(opts) {
if (opts.slim) {
return new Promise((resolve, reject) => {
// Resolve .tesselignore
var ignoreRules = actions.glob.rules(target, '.tesselignore').concat(includeNegateRules);
var ignoreFiles = actions.glob.files(globRoot, ignoreRules);

// Initialize a project for dependency graphing
var entry = path.join(relative, opts.resolvedEntryPoint);
Expand Down
9 changes: 5 additions & 4 deletions test/unit/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@ exports['deploy.tarBundle'] = {
// One call for .tesselinclude
// One call for the single rule found within
// Three calls for the deploy lists
test.equal(this.globSync.callCount, 4);
// * 2 (We need all ignore rules ahead of time for ignoring binaries)
test.equal(this.globSync.callCount, 8);

// addIgnoreRules might be called many times, but we only
// care about tracking the call that's explicitly made by
Expand Down Expand Up @@ -1063,7 +1064,7 @@ exports['deploy.tarBundle'] = {
target: path.normalize(target),
full: true,
}).then(function(bundle) {
test.equal(this.globSync.callCount, 7);
test.equal(this.globSync.callCount, 11);

// addIgnoreRules might be called many times, but we only
// care about tracking the call that's explicitly made by
Expand Down Expand Up @@ -1225,7 +1226,7 @@ exports['deploy.tarBundle'] = {
target: path.normalize(target),
full: true,
}).then(function(bundle) {
test.equal(this.globSync.callCount, 7);
test.equal(this.globSync.callCount, 8);

// addIgnoreRules might be called many times, but we only
// care about tracking the call that's explicitly made by
Expand Down Expand Up @@ -1394,7 +1395,7 @@ exports['deploy.tarBundle'] = {
target: path.normalize(target),
full: true,
}).then(function(bundle) {
test.equal(this.globSync.callCount, 7);
test.equal(this.globSync.callCount, 9);

// addIgnoreRules might be called many times, but we only
// care about tracking the call that's explicitly made by
Expand Down

0 comments on commit 84662a7

Please sign in to comment.