Skip to content

Commit

Permalink
Normalize deploy paths so Windows CI will pass grunt unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyman727 committed Nov 11, 2015
1 parent 295471d commit e42d1e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions lib/tessel/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ actions.tarBundle = function(opts) {
if (opts.slim) {
logs.info('Generating slim build.');
return new Promise(function(resolve, reject) {
actions.glob(target + '/**/*.tesselignore', {
actions.glob(target + path.normalize('/**/*.tesselignore'), {
dot: true,
mark: true,
}, function(error, ignoreFiles) {
Expand All @@ -334,13 +334,14 @@ actions.tarBundle = function(opts) {

return rules.concat(patterns);
}, []).map(function(rule) {

// Ensure it uses proper paths for OS
rule = path.normalize(rule);
if (rule[rule.length - 1] === '/') {
rule += '**/*.*';
rule += path.normalize('**/*.*');
}

if (rule[rule.length - 1] !== '*' && rule.indexOf('.') === -1) {
rule += '/**/*.*';
rule += path.normalize('/**/*.*');
}

return rule;
Expand Down
16 changes: 8 additions & 8 deletions test/unit/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,17 @@ exports['tarBundle'] = {
// The comment line MUST NOT create a pattern entry.
test.equal(this.globSync.callCount, 4);
test.deepEqual(this.globSync.args, [
['a/**/*.*', {
cwd: 'test/unit/fixtures/ignore'
[path.normalize('a/**/*.*'), {
cwd: path.normalize('test/unit/fixtures/ignore')
}],
['mock-foo.js', {
cwd: 'test/unit/fixtures/ignore'
[path.normalize('mock-foo.js'), {
cwd: path.normalize('test/unit/fixtures/ignore')
}],
['nested/b/**/*.*', {
cwd: 'test/unit/fixtures/ignore'
[path.normalize('nested/b/**/*.*'), {
cwd: path.normalize('test/unit/fixtures/ignore')
}],
['nested/file.js', {
cwd: 'test/unit/fixtures/ignore'
[path.normalize('nested/file.js'), {
cwd: path.normalize('test/unit/fixtures/ignore')
}]
]);

Expand Down

2 comments on commit e42d1e4

@johnnyman727
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwaldron can you comment on whether what I did here is acceptable?

@rwaldron
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine, but it's unnecessary—these tests are already passing on appveyor (also, this test is gone now anyway)

Please sign in to comment.