From 84662a75ae62c3ea292c7e9245331f836e22e773 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Fri, 19 Feb 2016 14:27:12 -0500 Subject: [PATCH] Step 1: Move tesselignore resolution ahead of conditional deployment path - Updates tests to correctly reflect the number of glob.sync calls to make. --- lib/tessel/deploy.js | 5 +++-- test/unit/deploy.js | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/tessel/deploy.js b/lib/tessel/deploy.js index 0ba139f3..322bfd36 100644 --- a/lib/tessel/deploy.js +++ b/lib/tessel/deploy.js @@ -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 @@ -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); diff --git a/test/unit/deploy.js b/test/unit/deploy.js index 6735b1d2..c0be3ace 100644 --- a/test/unit/deploy.js +++ b/test/unit/deploy.js @@ -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 @@ -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 @@ -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 @@ -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