Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/fstream-ignore/test/nested-ignores.js')
-rw-r--r--node_modules/fstream-ignore/test/nested-ignores.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/node_modules/fstream-ignore/test/nested-ignores.js b/node_modules/fstream-ignore/test/nested-ignores.js
new file mode 100644
index 000000000..a9ede59ca
--- /dev/null
+++ b/node_modules/fstream-ignore/test/nested-ignores.js
@@ -0,0 +1,51 @@
+// ignore most things
+var IgnoreFile = require("../")
+
+// set the ignores just for this test
+var c = require("./common.js")
+c.ignores(
+ { ".ignore": ["*", "a", "c", "!a/b/c/.abc", "!/c/b/a/cba"]
+ , "a/.ignore": [ "!*", ".ignore" ] // unignore everything
+ , "a/a/.ignore": [ "*" ] // re-ignore everything
+ , "a/b/.ignore": [ "*", "!/c/.abc" ] // original unignore
+ , "a/c/.ignore": [ "*" ] // ignore everything again
+ , "c/b/a/.ignore": [ "!cba", "!.cba", "!/a{bc,cb}" ]
+ })
+
+// the only files we expect to see
+var expected =
+ [ "/a"
+ , "/a/a"
+ , "/a/b"
+ , "/a/b/c"
+ , "/a/b/c/.abc"
+ , "/a/c"
+ , "/c"
+ , "/c/b"
+ , "/c/b/a"
+ , "/c/b/a/cba"
+ , "/c/b/a/.cba"
+ , "/c/b/a/abc"
+ , "/c/b/a/acb" ]
+
+require("tap").test("basic ignore rules", function (t) {
+ t.pass("start")
+
+ IgnoreFile({ path: __dirname + "/fixtures"
+ , ignoreFiles: [".ignore"] })
+ .on("child", function (e) {
+ var p = e.path.substr(e.root.path.length)
+ var i = expected.indexOf(p)
+ if (i === -1) {
+ console.log("not ok "+p)
+ t.fail("unexpected file found", {found: p})
+ } else {
+ t.pass(p)
+ expected.splice(i, 1)
+ }
+ })
+ .on("close", function () {
+ t.deepEqual(expected, [], "all expected files should be seen")
+ t.end()
+ })
+})