react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / fileset / node_modules / glob / test / mark.js
80713 viewsvar test = require("tap").test1var glob = require('../')2process.chdir(__dirname)34// expose timing issues5var lag = 56glob.Glob.prototype._stat = function(o) { return function(f, cb) {7var args = arguments8setTimeout(function() {9o.call(this, f, cb)10}.bind(this), lag += 5)11}}(glob.Glob.prototype._stat)121314test("mark, with **", function (t) {15glob("a/*b*/**", {mark: true}, function (er, results) {16if (er)17throw er18var expect =19[ 'a/abcdef/',20'a/abcdef/g/',21'a/abcdef/g/h',22'a/abcfed/',23'a/abcfed/g/',24'a/abcfed/g/h',25'a/b/',26'a/b/c/',27'a/b/c/d',28'a/bc/',29'a/bc/e/',30'a/bc/e/f',31'a/cb/',32'a/cb/e/',33'a/cb/e/f' ]3435t.same(results, expect)36t.end()37})38})3940test("mark, no / on pattern", function (t) {41glob("a/*", {mark: true}, function (er, results) {42if (er)43throw er44var expect = [ 'a/abcdef/',45'a/abcfed/',46'a/b/',47'a/bc/',48'a/c/',49'a/cb/' ]5051if (process.platform !== "win32")52expect.push('a/symlink/')5354t.same(results, expect)55t.end()56}).on('match', function(m) {57t.similar(m, /\/$/)58})59})6061test("mark=false, no / on pattern", function (t) {62glob("a/*", function (er, results) {63if (er)64throw er65var expect = [ 'a/abcdef',66'a/abcfed',67'a/b',68'a/bc',69'a/c',70'a/cb' ]7172if (process.platform !== "win32")73expect.push('a/symlink')74t.same(results, expect)75t.end()76}).on('match', function(m) {77t.similar(m, /[^\/]$/)78})79})8081test("mark=true, / on pattern", function (t) {82glob("a/*/", {mark: true}, function (er, results) {83if (er)84throw er85var expect = [ 'a/abcdef/',86'a/abcfed/',87'a/b/',88'a/bc/',89'a/c/',90'a/cb/' ]91if (process.platform !== "win32")92expect.push('a/symlink/')93t.same(results, expect)94t.end()95}).on('match', function(m) {96t.similar(m, /\/$/)97})98})99100test("mark=false, / on pattern", function (t) {101glob("a/*/", function (er, results) {102if (er)103throw er104var expect = [ 'a/abcdef/',105'a/abcfed/',106'a/b/',107'a/bc/',108'a/c/',109'a/cb/' ]110if (process.platform !== "win32")111expect.push('a/symlink/')112t.same(results, expect)113t.end()114}).on('match', function(m) {115t.similar(m, /\/$/)116})117})118119120