Skip to content

Commit

Permalink
fix: Ignore transient tap test directories (#364)
Browse files Browse the repository at this point in the history
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 <DanOfTheRoses@gmail.com>
  • Loading branch information
wraithgar authored Sep 15, 2023
1 parent cf286f5 commit 29bf19d
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const localConfigs = readdir(__dirname)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
'workspace/test-workspace/**',
],
extends: [
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# ignore everything in the root
/*
# transient test directories
tap-testdir*/

# keep these
!**/.gitignore
Expand Down
3 changes: 1 addition & 2 deletions lib/content/eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ const localConfigs = readdir(__dirname)

module.exports = {
root: true,
{{#if workspaceGlobs}}
ignorePatterns: [
'tap-testdir*/',
{{#each workspaceGlobs}}
'{{ . }}',
{{/each}}
],
{{/if}}
extends: [
'@npmcli',
...localConfigs,
Expand Down
2 changes: 2 additions & 0 deletions lib/content/gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ignore everything in the root
/*
# transient test directories
tap-testdir*/

# keep these
{{#each ignorePaths}}
Expand Down
4 changes: 3 additions & 1 deletion lib/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ module.exports = {
'/LICENSE*',
'/CHANGELOG*',
],
ignorePaths: [],
ignorePaths: [
/* to be provided by consuming package */
],
ciVersions: {},
latestCiVersion: 20,
lockfile: false,
Expand Down
28 changes: 28 additions & 0 deletions tap-snapshots/test/apply/source-snapshots.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const localConfigs = readdir(__dirname)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand Down Expand Up @@ -1638,6 +1641,8 @@ jobs:
# ignore everything in the root
/*
# transient test directories
tap-testdir*/
# keep these
!**/.gitignore
Expand Down Expand Up @@ -1873,6 +1878,7 @@ const localConfigs = readdir(__dirname)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
'workspaces/a/**',
'workspaces/b/**',
],
Expand Down Expand Up @@ -3855,6 +3861,8 @@ jobs:
# ignore everything in the root
/*
# transient test directories
tap-testdir*/
# keep these
!**/.gitignore
Expand Down Expand Up @@ -4078,6 +4086,9 @@ const localConfigs = readdir(__dirname)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand All @@ -4090,6 +4101,8 @@ workspaces/a/.gitignore
# ignore everything in the root
/*
# transient test directories
tap-testdir*/
# keep these
!**/.gitignore
Expand Down Expand Up @@ -4153,6 +4166,9 @@ const localConfigs = readdir(__dirname)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand All @@ -4165,6 +4181,8 @@ workspaces/b/.gitignore
# ignore everything in the root
/*
# transient test directories
tap-testdir*/
# keep these
!**/.gitignore
Expand Down Expand Up @@ -5877,6 +5895,9 @@ const localConfigs = readdir(__dirname)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand All @@ -5889,6 +5910,8 @@ workspaces/a/.gitignore
# ignore everything in the root
/*
# transient test directories
tap-testdir*/
# keep these
!**/.gitignore
Expand Down Expand Up @@ -5952,6 +5975,9 @@ const localConfigs = readdir(__dirname)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand All @@ -5964,6 +5990,8 @@ workspaces/b/.gitignore
# ignore everything in the root
/*
# transient test directories
tap-testdir*/
# keep these
!**/.gitignore
Expand Down
4 changes: 4 additions & 0 deletions tap-snapshots/test/check/snapshots.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.*
Expand All @@ -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.*
Expand Down
3 changes: 3 additions & 0 deletions workspace/test-workspace/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const localConfigs = readdir(__dirname)

module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand Down
2 changes: 2 additions & 0 deletions workspace/test-workspace/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# ignore everything in the root
/*
# transient test directories
tap-testdir*/

# keep these
!**/.gitignore
Expand Down

0 comments on commit 29bf19d

Please sign in to comment.