Skip to content

Commit

Permalink
Don’t run promise tests on old node versions
Browse files Browse the repository at this point in the history
If global.Promise is undefined.
  • Loading branch information
rjmunro committed Aug 4, 2016
1 parent d5a7778 commit df94408
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions test/recursive-readdir-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,22 @@ describe('readdir', function() {
})
})

it('works with promises', function(done) {
var expectedFiles = getAbsolutePaths([
'/testdir/a/a', '/testdir/a/beans',
'/testdir/b/123', '/testdir/b/b/hurp-durp',
'/testdir/c.txt', '/testdir/d.txt'
])
if (!global.Promise) {
console.log("Native Promise not supported - skipping tests")
} else {
it('works with promises', function(done) {

var expectedFiles = getAbsolutePaths([
'/testdir/a/a', '/testdir/a/beans',
'/testdir/b/123', '/testdir/b/b/hurp-durp',
'/testdir/c.txt', '/testdir/d.txt'
])

readdir(p.join(__dirname, 'testdir'))
.then(function(list) {
assert.deepEqual(list.sort(), expectedFiles.sort())
done()
readdir(p.join(__dirname, 'testdir'))
.then(function(list) {
assert.deepEqual(list.sort(), expectedFiles.sort())
done()
})
})
})
}
})

0 comments on commit df94408

Please sign in to comment.