From 89ac23051b38f86c20d2fc662d0edbdd68844d80 Mon Sep 17 00:00:00 2001 From: Joseph Frazier <1212jtraceur@gmail.com> Date: Tue, 11 Apr 2017 09:29:19 -0400 Subject: [PATCH] Test that `yarn pack` always includes the file in the "main" field This is for compatibility with npm, which [specifies] that: > Certain files are always included, regardless of settings: > * package.json > * README > * CHANGES / CHANGELOG / HISTORY > * LICENSE / LICENCE > * NOTICE > * The file in the "main" field [specifies]: https://docs.npmjs.com/files/package.json#files --- __tests__/commands/pack.js | 2 +- __tests__/fixtures/pack/files-include-mandatory/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/commands/pack.js b/__tests__/commands/pack.js index d4e19250b9..e5a4564a94 100644 --- a/__tests__/commands/pack.js +++ b/__tests__/commands/pack.js @@ -130,7 +130,7 @@ test.concurrent('pack should include mandatory files not listed in files array i path.join(cwd, 'files-include-mandatory-v1.0.0.tgz'), path.join(cwd, 'files-include-mandatory-v1.0.0'), ); - const expected = ['package.json', 'readme.md', 'license', 'changelog']; + const expected = ['package.json', 'index.js', 'readme.md', 'license', 'changelog']; expected.forEach((filename) => { expect(files.indexOf(filename)).toBeGreaterThanOrEqual(0); }); diff --git a/__tests__/fixtures/pack/files-include-mandatory/package.json b/__tests__/fixtures/pack/files-include-mandatory/package.json index 8747fee14b..fe7f6fe41e 100644 --- a/__tests__/fixtures/pack/files-include-mandatory/package.json +++ b/__tests__/fixtures/pack/files-include-mandatory/package.json @@ -3,5 +3,5 @@ "version": "1.0.0", "main": "index.js", "license": "MIT", - "files": ["index.js", "a.js", "b.js"] + "files": ["a.js", "b.js"] }