From 795cf0c0b102984242a0d4616b70f8608bd46883 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 5 Jun 2015 23:11:10 +0100 Subject: [PATCH] add ignore/only tests to ensure #1693 never happens again --- test/core/api.js | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/test/core/api.js b/test/core/api.js index d6c1597202..9ccd448b1f 100644 --- a/test/core/api.js +++ b/test/core/api.js @@ -28,6 +28,55 @@ suite("api", function () { }).code.indexOf("foobar") >= 0); }); + test("ignore", function () { + assert.ok(transform("", { + ignore: "node_modules", + filename: "/foo/node_modules/bar" + }).ignored); + + assert.ok(transform("", { + ignore: "foo/node_modules", + filename: "/foo/node_modules/bar" + }).ignored); + + assert.ok(transform("", { + ignore: "foo/node_modules/*.bar", + filename: "/foo/node_modules/foo.bar" + }).ignored); + }); + + test("only", function () { + assert.ok(!transform("", { + only: "node_modules", + filename: "/foo/node_modules/bar" + }).ignored); + + assert.ok(!transform("", { + only: "foo/node_modules", + filename: "/foo/node_modules/bar" + }).ignored); + + assert.ok(!transform("", { + only: "foo/node_modules/*.bar", + filename: "/foo/node_modules/foo.bar" + }).ignored); + + assert.ok(transform("", { + only: "node_modules", + filename: "/foo/node_module/bar" + }).ignored); + + assert.ok(transform("", { + only: "foo/node_modules", + filename: "/bar/node_modules/foo" + }).ignored); + + assert.ok(transform("", { + only: "foo/node_modules/*.bar", + filename: "/foo/node_modules/bar.foo" + }).ignored); + }); + suite("getModuleId() {} option", function () { // As of this commit, `getModuleId` is the only option that isn't JSON // compatible which is why it's not inside /test/core/fixtures/transformation