Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ignore transient tap test directories #350

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -155,7 +155,9 @@ module.exports = {
'/LICENSE*',
'/CHANGELOG*',
],
ignorePaths: [],
ignorePaths: [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll let @lukekarrys weigh in here since it's surprising to me coming in fresh on this that we don't have anything in here already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rotu the current pattern is to put these paths in lib/content/gitignore and leave ignorePaths as a config to be set by consumers. can you make that change? apologies that this is not discoverable! 🙇🏼

Copy link
Contributor Author

@rotu rotu Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. I can add the breadcrumbs that would have retroactively helped me. The lib/content/gitignore file is clearly a template of some sort. What instantiates this template?

EDIT: nvm found it: https://github.com/npm/template-oss/blob/2a5e18677f6de45d903b7d06ec7780c7d31b6963/lib/util/template.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, any reason why allowPaths and distPaths are inlined in this file but ignorePaths is not?

/* to be provided by consuming package */
lukekarrys marked this conversation as resolved.
Show resolved Hide resolved
],
ciVersions: ['14.17.0', '14.x', '16.13.0', '16.x', '18.0.0', '18.x'],
lockfile: false,
codeowner: '@npm/cli-team',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/npm/template-oss.git"
"url": "https://github.com/rotu/npm-template-oss.git"
lukekarrys marked this conversation as resolved.
Show resolved Hide resolved
},
"keywords": [
"npm",
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 @@ -1236,6 +1239,8 @@ jobs:

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

# keep these
!**/.gitignore
Expand Down Expand Up @@ -1474,6 +1479,7 @@ const localConfigs = readdir(__dirname)
module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
'workspaces/a/**',
'workspaces/b/**',
],
Expand Down Expand Up @@ -2916,6 +2922,8 @@ jobs:

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

# keep these
!**/.gitignore
Expand Down Expand Up @@ -3142,6 +3150,9 @@ const localConfigs = readdir(__dirname)

module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand All @@ -3154,6 +3165,8 @@ workspaces/a/.gitignore

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

# keep these
!**/.gitignore
Expand Down Expand Up @@ -3220,6 +3233,9 @@ const localConfigs = readdir(__dirname)

module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand All @@ -3232,6 +3248,8 @@ workspaces/b/.gitignore

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

# keep these
!**/.gitignore
Expand Down Expand Up @@ -4520,6 +4538,9 @@ const localConfigs = readdir(__dirname)

module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand All @@ -4532,6 +4553,8 @@ workspaces/a/.gitignore

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

# keep these
!**/.gitignore
Expand Down Expand Up @@ -4598,6 +4621,9 @@ const localConfigs = readdir(__dirname)

module.exports = {
root: true,
ignorePatterns: [
'tap-testdir*/',
],
extends: [
'@npmcli',
...localConfigs,
Expand All @@ -4610,6 +4636,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 @@ -123,6 +123,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 @@ -162,6 +163,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 @@ -199,6 +201,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 @@ -224,6 +227,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
2 changes: 1 addition & 1 deletion workspace/test-workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/npm/template-oss.git",
"url": "https://github.com/rotu/npm-template-oss.git",
lukekarrys marked this conversation as resolved.
Show resolved Hide resolved
"directory": "workspace/test-workspace"
},
"keywords": [],
Expand Down