Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80713 views
1
var tap = require("tap")
2
3
var origCwd = process.cwd()
4
process.chdir(__dirname)
5
6
tap.test("changing root and searching for /b*/**", function (t) {
7
var glob = require('../')
8
var path = require('path')
9
t.test('.', function (t) {
10
glob('/b*/**', { globDebug: true, root: '.', nomount: true }, function (er, matches) {
11
t.ifError(er)
12
t.like(matches, [])
13
t.end()
14
})
15
})
16
17
t.test('a', function (t) {
18
glob('/b*/**', { globDebug: true, root: path.resolve('a'), nomount: true }, function (er, matches) {
19
t.ifError(er)
20
t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ])
21
t.end()
22
})
23
})
24
25
t.test('root=a, cwd=a/b', function (t) {
26
glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b'), nomount: true }, function (er, matches) {
27
t.ifError(er)
28
t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ])
29
t.end()
30
})
31
})
32
33
t.test('cd -', function (t) {
34
process.chdir(origCwd)
35
t.end()
36
})
37
38
t.end()
39
})
40
41