Skip to content

Commit

Permalink
test(npm): add tests for odd package names
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard committed Jul 21, 2024
1 parent 973efd2 commit 58310f8
Show file tree
Hide file tree
Showing 11 changed files with 316 additions and 17 deletions.
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 @@ -16,6 +20,7 @@
"is-odd": "npm:[email protected]",
"is-odd-alt-version": "npm:is-odd@^2.0.0",
"uvu": "0.5.6",
"scoped/bad": "link:../projects/b",
"@scoped/a": "workspace:*",
"@scoped/b": "link:../projects/b",
"@scoped/c": "file:../projects/c",
Expand Down
14 changes: 14 additions & 0 deletions e2e/pnpm_lockfiles/lockfile-test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,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 @@ -73,6 +77,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 @@ -97,10 +102,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 @@ -116,6 +123,13 @@ def lockfile_test(name = None):
":node_modules/@aspect-test/a2",
# npm: alias to registry-scoped packages
":node_modules/alias-types-node",
# 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-alt-version",
":.aspect_rules_js/node_modules/[email protected]",
Expand Down
16 changes: 13 additions & 3 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.

55 changes: 54 additions & 1 deletion e2e/pnpm_lockfiles/v54/snapshots/defs.bzl

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

21 changes: 18 additions & 3 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.

Loading

0 comments on commit 58310f8

Please sign in to comment.