Skip to content

Commit

Permalink
test(npm): add tests for odd package names (#1860)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard committed Jul 22, 2024
1 parent 45c84b1 commit 9cede2b
Show file tree
Hide file tree
Showing 11 changed files with 299 additions and 1 deletion.
13 changes: 13 additions & 0 deletions e2e/pnpm_lockfiles/base/aliases-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ if (require('@aspect-test/a') !== require('@aspect-test/a2')) {
)
}

// Various other aliases with odd scoping
for (const pkg of [
'@aspect-test/a2',
'aspect-test-a-no-scope',
'aspect-test-a/no-at',
'@aspect-test-a-bad-scope',
'@aspect-test-custom-scope/a',
]) {
if (require('@aspect-test/a') !== require(pkg)) {
throw new Error(`${pkg} should be alias of @aspect-test/a`)
}
}

// `alias-types-node` and `@types/node` should be importable and equal
if (
require('alias-types-node/package.json') !==
Expand Down
5 changes: 5 additions & 0 deletions e2e/pnpm_lockfiles/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"dependencies": {
"@aspect-test/a": "^5.0.2",
"@aspect-test/a2": "npm:@aspect-test/a",
"aspect-test-a-no-scope": "npm:@aspect-test/a",
"aspect-test-a/no-at": "npm:@aspect-test/a",
"@aspect-test-a-bad-scope": "npm:@aspect-test/a",
"@aspect-test-custom-scope/a": "npm:@aspect-test/a",
"@isaacs/cliui": "8.0.2",
"debug": "ngokevin/debug#9742c5f383a6f8046241920156236ade8ec30d53",
"hello": "https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello",
Expand All @@ -20,6 +24,7 @@
"is-odd-v2": "npm:[email protected]",
"is-odd-v3": "npm:[email protected]",
"uvu": "0.5.6",
"scoped/bad": "link:../projects/b",
"@scoped/a": "workspace:*",
"@scoped/b": "link:../projects/b",
"@scoped/c": "file:../projects/c",
Expand Down
15 changes: 14 additions & 1 deletion e2e/pnpm_lockfiles/lockfile-test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def lockfile_test(name = None):
data = [
":node_modules/@aspect-test/a",
":node_modules/@aspect-test/a2",
":node_modules/aspect-test-a-no-scope",
":node_modules/aspect-test-a/no-at",
":node_modules/@aspect-test-a-bad-scope",
":node_modules/@aspect-test-custom-scope/a",
":node_modules/@types/node",
":node_modules/alias-only-sizzle",
":node_modules/alias-types-node",
Expand All @@ -80,6 +84,7 @@ def lockfile_test(name = None):
":node_modules",

# Direct 'dependencies'
":node_modules/@aspect-test", # target for the scope
":node_modules/@aspect-test/a",

# Direct 'devDependencies'
Expand All @@ -104,10 +109,12 @@ def lockfile_test(name = None):
":node_modules/@isaacs/cliui",

# link:, workspace:, file:, ./rel/path
":node_modules/@scoped", # target for the scope
":node_modules/@scoped/a",
":node_modules/@scoped/b",
":node_modules/@scoped/c",
":node_modules/@scoped/d",
":node_modules/scoped/bad",

# Packages involving overrides
":node_modules/is-odd",
Expand All @@ -123,7 +130,13 @@ def lockfile_test(name = None):
":node_modules/@aspect-test/a2",
# npm: alias to registry-scoped packages
":node_modules/alias-types-node",
":node_modules/is-odd-alias",
# npm: alias adding/removing or odd @scopes
":node_modules/aspect-test-a/no-at",
":node_modules/aspect-test-a-no-scope",
":node_modules/@aspect-test-a-bad-scope",
":node_modules/@aspect-test-custom-scope", # target for the scope
":node_modules/@aspect-test-custom-scope/a",

# npm: alias to alternate versions
":node_modules/is-odd-v0",
":node_modules/is-odd-v1",
Expand Down
10 changes: 10 additions & 0 deletions e2e/pnpm_lockfiles/v54/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions e2e/pnpm_lockfiles/v54/snapshots/defs.bzl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions e2e/pnpm_lockfiles/v60/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions e2e/pnpm_lockfiles/v60/snapshots/defs.bzl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions e2e/pnpm_lockfiles/v61/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9cede2b

Please sign in to comment.