From 29bf19d5b809b573185753321f5e498155c55f5b Mon Sep 17 00:00:00 2001 From: Gar Date: Fri, 15 Sep 2023 11:04:38 -0700 Subject: [PATCH] fix: Ignore transient tap test directories (#364) Running tests causes a lot of file churn. Although (usually) ephemeral, these files cause high CPU usage and can make developer tools difficult to use. These files also make linting fail. Now the files will be ignored by git and by eslint. ## References Fixes #348 Fixes #359 This is a rebase of #350 since it had yet another conflict. --------- Authored-by: Dan --- .eslintrc.js | 1 + .gitignore | 2 ++ lib/content/eslintrc.js | 3 +- lib/content/gitignore | 2 ++ lib/content/index.js | 4 ++- .../test/apply/source-snapshots.js.test.cjs | 28 +++++++++++++++++++ .../test/check/snapshots.js.test.cjs | 4 +++ workspace/test-workspace/.eslintrc.js | 3 ++ workspace/test-workspace/.gitignore | 2 ++ 9 files changed, 46 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 11ee4479..0c65d1f5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,6 +11,7 @@ const localConfigs = readdir(__dirname) module.exports = { root: true, ignorePatterns: [ + 'tap-testdir*/', 'workspace/test-workspace/**', ], extends: [ diff --git a/.gitignore b/.gitignore index 135c3883..411ec4df 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ # ignore everything in the root /* +# transient test directories +tap-testdir*/ # keep these !**/.gitignore diff --git a/lib/content/eslintrc.js b/lib/content/eslintrc.js index 8ee511c7..96996354 100644 --- a/lib/content/eslintrc.js +++ b/lib/content/eslintrc.js @@ -8,13 +8,12 @@ const localConfigs = readdir(__dirname) module.exports = { root: true, - {{#if workspaceGlobs}} ignorePatterns: [ + 'tap-testdir*/', {{#each workspaceGlobs}} '{{ . }}', {{/each}} ], - {{/if}} extends: [ '@npmcli', ...localConfigs, diff --git a/lib/content/gitignore b/lib/content/gitignore index d9d4b23e..21074e32 100644 --- a/lib/content/gitignore +++ b/lib/content/gitignore @@ -1,5 +1,7 @@ # ignore everything in the root /* +# transient test directories +tap-testdir*/ # keep these {{#each ignorePaths}} diff --git a/lib/content/index.js b/lib/content/index.js index 19c8117f..ed916cc9 100644 --- a/lib/content/index.js +++ b/lib/content/index.js @@ -157,7 +157,9 @@ module.exports = { '/LICENSE*', '/CHANGELOG*', ], - ignorePaths: [], + ignorePaths: [ + /* to be provided by consuming package */ + ], ciVersions: {}, latestCiVersion: 20, lockfile: false, diff --git a/tap-snapshots/test/apply/source-snapshots.js.test.cjs b/tap-snapshots/test/apply/source-snapshots.js.test.cjs index ec1bf3d9..f8165606 100644 --- a/tap-snapshots/test/apply/source-snapshots.js.test.cjs +++ b/tap-snapshots/test/apply/source-snapshots.js.test.cjs @@ -33,6 +33,9 @@ const localConfigs = readdir(__dirname) module.exports = { root: true, + ignorePatterns: [ + 'tap-testdir*/', + ], extends: [ '@npmcli', ...localConfigs, @@ -1638,6 +1641,8 @@ jobs: # ignore everything in the root /* +# transient test directories +tap-testdir*/ # keep these !**/.gitignore @@ -1873,6 +1878,7 @@ const localConfigs = readdir(__dirname) module.exports = { root: true, ignorePatterns: [ + 'tap-testdir*/', 'workspaces/a/**', 'workspaces/b/**', ], @@ -3855,6 +3861,8 @@ jobs: # ignore everything in the root /* +# transient test directories +tap-testdir*/ # keep these !**/.gitignore @@ -4078,6 +4086,9 @@ const localConfigs = readdir(__dirname) module.exports = { root: true, + ignorePatterns: [ + 'tap-testdir*/', + ], extends: [ '@npmcli', ...localConfigs, @@ -4090,6 +4101,8 @@ workspaces/a/.gitignore # ignore everything in the root /* +# transient test directories +tap-testdir*/ # keep these !**/.gitignore @@ -4153,6 +4166,9 @@ const localConfigs = readdir(__dirname) module.exports = { root: true, + ignorePatterns: [ + 'tap-testdir*/', + ], extends: [ '@npmcli', ...localConfigs, @@ -4165,6 +4181,8 @@ workspaces/b/.gitignore # ignore everything in the root /* +# transient test directories +tap-testdir*/ # keep these !**/.gitignore @@ -5877,6 +5895,9 @@ const localConfigs = readdir(__dirname) module.exports = { root: true, + ignorePatterns: [ + 'tap-testdir*/', + ], extends: [ '@npmcli', ...localConfigs, @@ -5889,6 +5910,8 @@ workspaces/a/.gitignore # ignore everything in the root /* +# transient test directories +tap-testdir*/ # keep these !**/.gitignore @@ -5952,6 +5975,9 @@ const localConfigs = readdir(__dirname) module.exports = { root: true, + ignorePatterns: [ + 'tap-testdir*/', + ], extends: [ '@npmcli', ...localConfigs, @@ -5964,6 +5990,8 @@ workspaces/b/.gitignore # ignore everything in the root /* +# transient test directories +tap-testdir*/ # keep these !**/.gitignore diff --git a/tap-snapshots/test/check/snapshots.js.test.cjs b/tap-snapshots/test/check/snapshots.js.test.cjs index 0c2c6c71..bd280ee0 100644 --- a/tap-snapshots/test/check/snapshots.js.test.cjs +++ b/tap-snapshots/test/check/snapshots.js.test.cjs @@ -120,6 +120,7 @@ The following files are tracked by git but matching a pattern in .gitignore: To correct it: move files to not match one of the following patterns: /* + tap-testdir*/ !**/.gitignore !/.commitlintrc.js !/.eslintrc.js @@ -159,6 +160,7 @@ The following files are tracked by git but matching a pattern in .gitignore: To correct it: move files to not match one of the following patterns: /* + tap-testdir*/ !**/.gitignore !/.commitlintrc.js !/.eslintrc.js @@ -196,6 +198,7 @@ The following files are tracked by git but matching a pattern in workspaces/a/.g To correct it: move files to not match one of the following patterns: /* + tap-testdir*/ !**/.gitignore !/.eslintrc.js !/.eslintrc.local.* @@ -221,6 +224,7 @@ The following files are tracked by git but matching a pattern in workspaces/b/.g To correct it: move files to not match one of the following patterns: /* + tap-testdir*/ !**/.gitignore !/.eslintrc.js !/.eslintrc.local.* diff --git a/workspace/test-workspace/.eslintrc.js b/workspace/test-workspace/.eslintrc.js index 5db9f815..f21d26ec 100644 --- a/workspace/test-workspace/.eslintrc.js +++ b/workspace/test-workspace/.eslintrc.js @@ -10,6 +10,9 @@ const localConfigs = readdir(__dirname) module.exports = { root: true, + ignorePatterns: [ + 'tap-testdir*/', + ], extends: [ '@npmcli', ...localConfigs, diff --git a/workspace/test-workspace/.gitignore b/workspace/test-workspace/.gitignore index 79af2bfc..a96d056a 100644 --- a/workspace/test-workspace/.gitignore +++ b/workspace/test-workspace/.gitignore @@ -2,6 +2,8 @@ # ignore everything in the root /* +# transient test directories +tap-testdir*/ # keep these !**/.gitignore