diff options
author | isaacs <i@izs.me> | 2017-05-30 20:31:02 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-08-23 02:17:30 +0300 |
commit | eccf7708b1f63a323eb291d3dbeb4a96be6cf164 (patch) | |
tree | 3d00316552b9d924ff6b8e84432b56ce76967856 | |
parent | 3dcd4b81911f45f03c0b0f7646e39379d1de267f (diff) |
test: ignore files ignored by default, default ignores are overridable
Credit: @isaacs
Reviewed-By: @iarna
PR-URL: https://github.com/npm/npm/pull/16804
-rw-r--r-- | test/tap/files-and-ignores.js | 85 |
1 files changed, 67 insertions, 18 deletions
diff --git a/test/tap/files-and-ignores.js b/test/tap/files-and-ignores.js index 543120bac..6d44f3ea3 100644 --- a/test/tap/files-and-ignores.js +++ b/test/tap/files-and-ignores.js @@ -383,7 +383,55 @@ test('include main file', function (t) { }) }) -test('certain files ignored unconditionally', function (t) { +test('certain files ignored by default', function (t) { + var fixture = new Tacks( + Dir({ + 'package.json': File({ + name: 'npm-test-files', + version: '1.2.5' + }), + '.git': Dir({foo: File('')}), + '.svn': Dir({foo: File('')}), + 'CVS': Dir({foo: File('')}), + '.hg': Dir({foo: File('')}), + '.lock-wscript': File(''), + '.wafpickle-0': File(''), + '.wafpickle-5': File(''), + '.wafpickle-50': File(''), + 'build': Dir({'config.gypi': File('')}), + 'npm-debug.log': File(''), + '.npmrc': File(''), + '.foo.swp': File(''), + '.DS_Store': Dir({foo: File('')}), + '._ohno': File(''), + '._ohnoes': Dir({noes: File('')}), + 'foo.orig': File(''), + 'package-lock.json': File('') + }) + ) + withFixture(t, fixture, function (done) { + t.notOk(fileExists('.git'), '.git not included') + t.notOk(fileExists('.svn'), '.svn not included') + t.notOk(fileExists('CVS'), 'CVS not included') + t.notOk(fileExists('.hg'), '.hg not included') + t.notOk(fileExists('.lock-wscript'), '.lock-wscript not included') + t.notOk(fileExists('.wafpickle-0'), '.wafpickle-0 not included') + t.notOk(fileExists('.wafpickle-5'), '.wafpickle-5 not included') + t.notOk(fileExists('.wafpickle-50'), '.wafpickle-50 not included') + t.notOk(fileExists('build/config.gypi'), 'build/config.gypi not included') + t.notOk(fileExists('npm-debug.log'), 'npm-debug.log not included') + t.notOk(fileExists('.npmrc'), '.npmrc not included') + t.notOk(fileExists('.foo.swp'), '.foo.swp not included') + t.notOk(fileExists('.DS_Store'), '.DS_Store not included') + t.notOk(fileExists('._ohno'), '._ohno not included') + t.notOk(fileExists('._ohnoes'), '._ohnoes not included') + t.notOk(fileExists('foo.orig'), 'foo.orig not included') + t.notOk(fileExists('package-lock.json'), 'package-lock.json not included') + done() + }) +}) + +test('default-ignored files can be explicitly included', function (t) { var fixture = new Tacks( Dir({ 'package.json': File({ @@ -404,6 +452,7 @@ test('certain files ignored unconditionally', function (t) { '.foo.swp', '.DS_Store', '._ohno', + '._ohnoes', 'foo.orig', 'package-lock.json' ] @@ -428,23 +477,23 @@ test('certain files ignored unconditionally', function (t) { }) ) withFixture(t, fixture, function (done) { - t.notOk(fileExists('.git'), '.git not included') - t.notOk(fileExists('.svn'), '.svn not included') - t.notOk(fileExists('CVS'), 'CVS not included') - t.notOk(fileExists('.hg'), '.hg not included') - t.notOk(fileExists('.lock-wscript'), '.lock-wscript not included') - t.notOk(fileExists('.wafpickle-0'), '.wafpickle-0 not included') - t.notOk(fileExists('.wafpickle-5'), '.wafpickle-5 not included') - t.notOk(fileExists('.wafpickle-50'), '.wafpickle-50 not included') - t.notOk(fileExists('build/config.gypi'), 'build/config.gypi not included') - t.notOk(fileExists('npm-debug.log'), 'npm-debug.log not included') - t.notOk(fileExists('.npmrc'), '.npmrc not included') - t.notOk(fileExists('.foo.swp'), '.foo.swp not included') - t.notOk(fileExists('.DS_Store'), '.DS_Store not included') - t.notOk(fileExists('._ohno'), '._ohno not included') - t.notOk(fileExists('._ohnoes'), '._ohnoes not included') - t.notOk(fileExists('foo.orig'), 'foo.orig not included') - t.notOk(fileExists('package-lock.json'), 'package-lock.json not included') + t.ok(fileExists('.git'), '.git included') + t.ok(fileExists('.svn'), '.svn included') + t.ok(fileExists('CVS'), 'CVS included') + t.ok(fileExists('.hg'), '.hg included') + t.ok(fileExists('.lock-wscript'), '.lock-wscript included') + t.ok(fileExists('.wafpickle-0'), '.wafpickle-0 included') + t.ok(fileExists('.wafpickle-5'), '.wafpickle-5 included') + t.ok(fileExists('.wafpickle-50'), '.wafpickle-50 included') + t.ok(fileExists('build/config.gypi'), 'build/config.gypi included') + t.ok(fileExists('npm-debug.log'), 'npm-debug.log included') + t.ok(fileExists('.npmrc'), '.npmrc included') + t.ok(fileExists('.foo.swp'), '.foo.swp included') + t.ok(fileExists('.DS_Store'), '.DS_Store included') + t.ok(fileExists('._ohno'), '._ohno included') + t.ok(fileExists('._ohnoes'), '._ohnoes included') + t.ok(fileExists('foo.orig'), 'foo.orig included') + t.ok(fileExists('package-lock.json'), 'package-lock.json included') done() }) }) |