From 08fccd4e273f539022366cd3bada7ac55e66f22a Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Tue, 10 Feb 2015 11:44:32 -0800 Subject: [PATCH] Don't run tests with colon filenames on Windows These tests are intended to guard against accidentally working with files that have colons when on Mac/Linux, and then those packages not working on Windows. There's nothing to test about the other direction. --- tools/tests/colon-converter-tests.js | 67 +++++++++++++++------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/tools/tests/colon-converter-tests.js b/tools/tests/colon-converter-tests.js index 1ef6ba436c..bca092599f 100644 --- a/tools/tests/colon-converter-tests.js +++ b/tools/tests/colon-converter-tests.js @@ -53,42 +53,49 @@ var randomizedPackageName = function (username, start) { return username + ":" + startStr + utils.randomToken().substring(0, 6); }; -selftest.define("can't publish package with colons", ["net", "test-package-server"], function () { - var s = new Sandbox(); +// On Mac and Linux, we can add NPM libraries with colons in filenames, but we +// test that they shouldn't build (since they can later never run on Windows). +// But we can't run these tests on Windows since when you call `npm install` +// on a module that has filenames with colons -- the module gets added, but +// without the colon filenames. +if (process.platform !== "win32") { + selftest.define("can't publish package with colons", ["net", "test-package-server"], function () { + var s = new Sandbox(); - testUtils.login(s, username, password); - var packageName = randomizedPackageName(username, "package-with-colons"); - var packageDirName = "package-with-colons"; - s.createPackage(packageDirName, packageName, "package-with-colons"); + testUtils.login(s, username, password); + var packageName = randomizedPackageName(username, "package-with-colons"); + var packageDirName = "package-with-colons"; + s.createPackage(packageDirName, packageName, "package-with-colons"); - s.cd(packageDirName, function () { - var run = s.run("publish", "--create"); + s.cd(packageDirName, function () { + var run = s.run("publish", "--create"); - run.matchErr("invalid characters"); + run.matchErr("invalid characters"); - // This error can basically only occur on files from npm - run.matchErr("NPM module"); - }); -}); - -selftest.define("can't build local packages with colons", function () { - var s = new Sandbox(); - - var appName = "test"; - var packageName = "package-with-colons"; - - s.createApp(appName, "standard-app"); - - s.cd(appName, function () { - s.mkdir("packages"); - s.cd("packages", function () { - s.createPackage("package-with-colons", packageName, "package-with-colons"); + // This error can basically only occur on files from npm + run.matchErr("NPM module"); }); - - var run = s.run("add", packageName); - run.matchErr("colons"); }); -}); + + selftest.define("can't build local packages with colons", function () { + var s = new Sandbox(); + + var appName = "test"; + var packageName = "package-with-colons"; + + s.createApp(appName, "standard-app"); + + s.cd(appName, function () { + s.mkdir("packages"); + s.cd("packages", function () { + s.createPackage("package-with-colons", packageName, "package-with-colons"); + }); + + var run = s.run("add", packageName); + run.matchErr("colons"); + }); + }); +} // Tests step 2: old packages downloaded as-is