From 5a295017ec4fe818dcf36d67fd63b85b95a2fcdc Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Mon, 1 May 2017 11:39:25 -0700 Subject: [PATCH] Fix failing tests on `master` branch (#469) * remove "always-include-main" test case It was testing for incorrect behavior that has now been fixed. See: https://github.com/zeit/now-cli/pull/464 * remove "files" array from `main` related test cases Makes these three tests pass once again. * always run a test for "pack-now" even when not in CI Otherwise `ava` fails because the test did not run any assertions. --- test/_fixtures/always-include-main/a.js | 1 - test/_fixtures/always-include-main/b.js | 1 - test/_fixtures/always-include-main/package.json | 10 ---------- test/_fixtures/always-include-main/woot.js | 1 - test/_fixtures/directory-main/package.json | 1 - test/_fixtures/extensionless-main/package.json | 1 - test/_fixtures/simple-main/package.json | 1 - test/index.js | 9 --------- test/pack-now.js | 10 ++++++++-- 9 files changed, 8 insertions(+), 27 deletions(-) delete mode 100644 test/_fixtures/always-include-main/a.js delete mode 100644 test/_fixtures/always-include-main/b.js delete mode 100644 test/_fixtures/always-include-main/package.json delete mode 100644 test/_fixtures/always-include-main/woot.js diff --git a/test/_fixtures/always-include-main/a.js b/test/_fixtures/always-include-main/a.js deleted file mode 100644 index dcdb2da..0000000 --- a/test/_fixtures/always-include-main/a.js +++ /dev/null @@ -1 +0,0 @@ -// should be included diff --git a/test/_fixtures/always-include-main/b.js b/test/_fixtures/always-include-main/b.js deleted file mode 100644 index 89dd8fc..0000000 --- a/test/_fixtures/always-include-main/b.js +++ /dev/null @@ -1 +0,0 @@ -// should NOT be included diff --git a/test/_fixtures/always-include-main/package.json b/test/_fixtures/always-include-main/package.json deleted file mode 100644 index 18abbdb..0000000 --- a/test/_fixtures/always-include-main/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "should-include-main", - "version": "0.0.1", - "description": "", - "main": "a.js", - "files": [ - "woot.js" - ], - "dependencies": {} -} diff --git a/test/_fixtures/always-include-main/woot.js b/test/_fixtures/always-include-main/woot.js deleted file mode 100644 index dcdb2da..0000000 --- a/test/_fixtures/always-include-main/woot.js +++ /dev/null @@ -1 +0,0 @@ -// should be included diff --git a/test/_fixtures/directory-main/package.json b/test/_fixtures/directory-main/package.json index 8b2cc5e..acca41d 100644 --- a/test/_fixtures/directory-main/package.json +++ b/test/_fixtures/directory-main/package.json @@ -3,6 +3,5 @@ "version": "0.0.1", "description": "", "main": "./a", - "files": ["build/a.js"], "dependencies": {} } diff --git a/test/_fixtures/extensionless-main/package.json b/test/_fixtures/extensionless-main/package.json index 08ded87..7d093bb 100644 --- a/test/_fixtures/extensionless-main/package.json +++ b/test/_fixtures/extensionless-main/package.json @@ -3,6 +3,5 @@ "version": "0.0.1", "description": "", "main": "./index", - "files": ["build/a.js"], "dependencies": {} } diff --git a/test/_fixtures/simple-main/package.json b/test/_fixtures/simple-main/package.json index 57424e1..3e56224 100644 --- a/test/_fixtures/simple-main/package.json +++ b/test/_fixtures/simple-main/package.json @@ -3,6 +3,5 @@ "version": "0.0.1", "description": "", "main": "./index.js", - "files": ["build/a.js"], "dependencies": {} } diff --git a/test/index.js b/test/index.js index 237cbcd..091c133 100644 --- a/test/index.js +++ b/test/index.js @@ -139,15 +139,6 @@ test('ignore nested `node_modules` with .npmignore **', async t => { t.is(base(files[1]), 'nested-node_modules/package.json'); }); -test('include `main` even if not in files', async t => { - let files = await getNpmFiles(fixture('always-include-main')); - files = files.sort(alpha); - t.is(files.length, 3); - t.is(base(files[0]), 'always-include-main/a.js'); - t.is(base(files[1]), 'always-include-main/package.json'); - t.is(base(files[2]), 'always-include-main/woot.js'); -}); - test('support whitelisting with .npmignore and !', async t => { let files = await getNpmFiles(fixture('negation')); files = files.sort(alpha); diff --git a/test/pack-now.js b/test/pack-now.js index f706e07..cdfec05 100644 --- a/test/pack-now.js +++ b/test/pack-now.js @@ -5,7 +5,10 @@ const test = require('ava'); const logo = require('../lib/utils/output/logo'); test.serial('make binary', async t => { - if (!process.env.CI) return; // eslint-disable-line curly + if (!process.env.CI) { + t.true(true); + return; + } const result = await spawn('npm', ['run', 'pack']); t.is(result.code, 0); }); @@ -20,7 +23,10 @@ const binaryPath = path.resolve(__dirname, '../packed/' + binary); const deployHelpMessage = `${logo} now [options] `; test.serial('packed "now help" prints deploy help message', async t => { - if (!process.env.CI) return; // eslint-disable-line curly + if (!process.env.CI) { + t.true(true); + return; + } const result = await spawn(binaryPath, ['help']); t.is(result.code, 0);