Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80713 views
1
var glob = require('../')
2
var test = require('tap').test
3
var path = require('path')
4
5
test('stat all the things', function(t) {
6
var g = new glob.Glob('a/*abc*/**', { stat: true, cwd: __dirname })
7
var matches = []
8
g.on('match', function(m) {
9
matches.push(m)
10
})
11
var stats = []
12
g.on('stat', function(m) {
13
stats.push(m)
14
})
15
g.on('end', function(eof) {
16
stats = stats.sort()
17
matches = matches.sort()
18
eof = eof.sort()
19
t.same(stats, matches)
20
t.same(eof, matches)
21
var cache = Object.keys(this.statCache)
22
t.same(cache.map(function (f) {
23
return path.relative(__dirname, f)
24
}).sort(), matches)
25
26
cache.forEach(function(c) {
27
t.equal(typeof this.statCache[c], 'object')
28
}, this)
29
30
t.end()
31
})
32
})
33
34