1 var tap = require("tap")
3 var origCwd = process.cwd()
4 process.chdir(__dirname)
6 tap.test("changing cwd and searching for **/d", function (t) {
7 var glob = require('../')
8 var path = require('path')
9 t.test('.', function (t) {
10 glob('**/d', function (er, matches) {
12 t.like(matches, [ 'a/b/c/d', 'a/c/d' ])
17 t.test('a', function (t) {
18 glob('**/d', {cwd:path.resolve('a')}, function (er, matches) {
20 t.like(matches, [ 'b/c/d', 'c/d' ])
25 t.test('a/b', function (t) {
26 glob('**/d', {cwd:path.resolve('a/b')}, function (er, matches) {
28 t.like(matches, [ 'c/d' ])
33 t.test('a/b/', function (t) {
34 glob('**/d', {cwd:path.resolve('a/b/')}, function (er, matches) {
36 t.like(matches, [ 'c/d' ])
41 t.test('.', function (t) {
42 glob('**/d', {cwd: process.cwd()}, function (er, matches) {
44 t.like(matches, [ 'a/b/c/d', 'a/c/d' ])
49 t.test('cd -', function (t) {
50 process.chdir(origCwd)