Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "optional-parent",
"version": "1.0.0",
"optionalDependencies": {
"is-number": "7.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "command-add-npm10",
"name": "command-add-npm",
"version": "1.0.0",
"packageManager": "npm@10.9.4"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[[case]]
name = "command_add_npm10"
vp = "global"
skip-platforms = ["windows"]
steps = [
{ argv = ["vp", "add", "--help"], comment = "should show help", continue-on-failure = true },
{ argv = ["vp", "add", "testnpm2", "-D", "--", "--no-audit"], comment = "should add package as dev dependencies" },
{ argv = ["vpt", "print-file", "package.json"], continue-on-failure = true },
{ argv = ["vp", "add", "testnpm2", "test-vite-plus-install", "--allow-build=test-vite-plus-install", "--", "--no-audit"], comment = "reject unsupported --allow-build without adding packages", continue-on-failure = true },
{ argv = ["vpt", "print-file", "package.json"], continue-on-failure = true },
{ argv = ["vp", "install", "test-vite-plus-package@1.0.0", "--save-peer", "--", "--no-audit"], comment = "should install package alias for add" },
{ argv = ["vpt", "print-file", "package.json"], continue-on-failure = true },
{ argv = ["vp", "add", "test-vite-plus-package-optional", "-O", "--", "--no-audit"], comment = "should add package as optional dependencies" },
{ argv = ["vpt", "print-file", "package.json"], continue-on-failure = true },
{ argv = ["vp", "add", "test-vite-plus-package-optional", "--", "--loglevel=warn", "--no-audit"], comment = "support pass through arguments" },
{ argv = ["vpt", "print-file", "package.json"], continue-on-failure = true },
]

[[case]]
name = "npm6_dependency_filters_add"
vp = "global"
env = { npm_config_audit = "false", npm_config_fund = "false" }
steps = [
{ argv = ["vpt", "json-edit", "package.json", "packageManager", "npm@6.14.18"], snapshot = false },
{ argv = ["vpt", "json-edit", "package.json", "dependencies.is-number", "6.0.0"], snapshot = false },
{ argv = ["vp", "install", "--ignore-scripts", "--silent"], snapshot = false },
{ argv = ["vp", "pm", "pack", "--", "./optional-parent", "--ignore-scripts"], snapshot = false },
{ argv = ["vp", "add", "./optional-parent-1.0.0.tgz", "--ignore-scripts", "--silent"], comment = "without a filter, the optional dependency is installed inside the added package" },
["vpt", "stat-file", "node_modules/optional-parent/node_modules/is-number/package.json", "--assert", "file"],
{ argv = ["vpt", "rm", "-rf", "node_modules/optional-parent", "package-lock.json"], snapshot = false },
["vp", "add", "./optional-parent-1.0.0.tgz", "--no-optional", "--ignore-scripts", "--silent"],
["vpt", "stat-file", "node_modules/optional-parent/package.json", "--assert", "file"],
["vpt", "stat-file", "node_modules/optional-parent/node_modules/is-number/package.json", "--assert", "missing"],
{ argv = ["vpt", "rm", "-rf", "node_modules/optional-parent", "package-lock.json"], snapshot = false },
["vp", "install", "./optional-parent-1.0.0.tgz", "--no-optional", "--ignore-scripts", "--silent"],
["vpt", "stat-file", "node_modules/optional-parent/package.json", "--assert", "file"],
["vpt", "stat-file", "node_modules/optional-parent/node_modules/is-number/package.json", "--assert", "missing"],
["vpt", "stat-file", "node_modules/is-number/package.json", "--assert", "file"],
]

[[case]]
name = "npm10_dependency_filters_add"
vp = "global"
env = { npm_config_audit = "false", npm_config_fund = "false" }
steps = [
{ argv = ["vpt", "json-edit", "package.json", "dependencies.is-number", "6.0.0"], snapshot = false },
{ argv = ["vp", "install", "--ignore-scripts", "--silent"], snapshot = false },
{ argv = ["vp", "pm", "pack", "--", "./optional-parent", "--ignore-scripts"], snapshot = false },
["vp", "add", "./optional-parent-1.0.0.tgz", "--ignore-scripts", "--silent"],
["vpt", "stat-file", "node_modules/optional-parent/node_modules/is-number/package.json", "--assert", "file"],
{ argv = ["vpt", "rm", "-rf", "node_modules/optional-parent", "package-lock.json"], snapshot = false },
["vp", "add", "./optional-parent-1.0.0.tgz", "--no-optional", "--ignore-scripts", "--silent"],
["vpt", "stat-file", "node_modules/optional-parent/package.json", "--assert", "file"],
["vpt", "stat-file", "node_modules/optional-parent/node_modules/is-number/package.json", "--assert", "missing"],
{ argv = ["vpt", "rm", "-rf", "node_modules/optional-parent", "package-lock.json"], snapshot = false },
["vp", "install", "./optional-parent-1.0.0.tgz", "--no-optional", "--ignore-scripts", "--silent"],
["vpt", "stat-file", "node_modules/optional-parent/package.json", "--assert", "file"],
["vpt", "stat-file", "node_modules/optional-parent/node_modules/is-number/package.json", "--assert", "missing"],
]
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ added 1 package in <duration>

```
{
"name": "command-add-npm10",
"name": "command-add-npm",
"version": "1.0.0",
"packageManager": "npm@10.9.4",
"devDependencies": {
Expand All @@ -82,7 +82,7 @@ npm does not support --allow-build.

```
{
"name": "command-add-npm10",
"name": "command-add-npm",
"version": "1.0.0",
"packageManager": "npm@10.9.4",
"devDependencies": {
Expand All @@ -105,7 +105,7 @@ added 1 package in <duration>

```
{
"name": "command-add-npm10",
"name": "command-add-npm",
"version": "1.0.0",
"packageManager": "npm@10.9.4",
"devDependencies": {
Expand All @@ -130,7 +130,7 @@ added 1 package in <duration>

```
{
"name": "command-add-npm10",
"name": "command-add-npm",
"version": "1.0.0",
"packageManager": "npm@10.9.4",
"devDependencies": {
Expand Down Expand Up @@ -158,7 +158,7 @@ up to date in <duration>

```
{
"name": "command-add-npm10",
"name": "command-add-npm",
"version": "1.0.0",
"packageManager": "npm@10.9.4",
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# npm10_dependency_filters_add

## `vpt json-edit package.json dependencies.is-number 6.0.0`


## `vp install --ignore-scripts --silent`


## `vp pm pack -- ./optional-parent --ignore-scripts`


## `vp add ./optional-parent-1.0.0.tgz --ignore-scripts --silent`

```
```

## `vpt stat-file node_modules/optional-parent/node_modules/is-number/package.json --assert file`

```
node_modules/optional-parent/node_modules/is-number/package.json: file
```

## `vpt rm -rf node_modules/optional-parent package-lock.json`


## `vp add ./optional-parent-1.0.0.tgz --no-optional --ignore-scripts --silent`

```
```

## `vpt stat-file node_modules/optional-parent/package.json --assert file`

```
node_modules/optional-parent/package.json: file
```

## `vpt stat-file node_modules/optional-parent/node_modules/is-number/package.json --assert missing`

```
node_modules/optional-parent/node_modules/is-number/package.json: missing
```

## `vpt rm -rf node_modules/optional-parent package-lock.json`


## `vp install ./optional-parent-1.0.0.tgz --no-optional --ignore-scripts --silent`

```
```

## `vpt stat-file node_modules/optional-parent/package.json --assert file`

```
node_modules/optional-parent/package.json: file
```

## `vpt stat-file node_modules/optional-parent/node_modules/is-number/package.json --assert missing`

```
node_modules/optional-parent/node_modules/is-number/package.json: missing
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# npm6_dependency_filters_add

## `vpt json-edit package.json packageManager npm@6.14.18`


## `vpt json-edit package.json dependencies.is-number 6.0.0`


## `vp install --ignore-scripts --silent`


## `vp pm pack -- ./optional-parent --ignore-scripts`


## `vp add ./optional-parent-1.0.0.tgz --ignore-scripts --silent`

without a filter, the optional dependency is installed inside the added package

```
optional-parent@1.0.0
added 2 packages from 3 contributors in <duration>
```

## `vpt stat-file node_modules/optional-parent/node_modules/is-number/package.json --assert file`

```
node_modules/optional-parent/node_modules/is-number/package.json: file
```

## `vpt rm -rf node_modules/optional-parent package-lock.json`


## `vp add ./optional-parent-1.0.0.tgz --no-optional --ignore-scripts --silent`

```
optional-parent@1.0.0
added 1 package in <duration>
```

## `vpt stat-file node_modules/optional-parent/package.json --assert file`

```
node_modules/optional-parent/package.json: file
```

## `vpt stat-file node_modules/optional-parent/node_modules/is-number/package.json --assert missing`

```
node_modules/optional-parent/node_modules/is-number/package.json: missing
```

## `vpt rm -rf node_modules/optional-parent package-lock.json`


## `vp install ./optional-parent-1.0.0.tgz --no-optional --ignore-scripts --silent`

```
optional-parent@1.0.0
added 1 package in <duration>
```

## `vpt stat-file node_modules/optional-parent/package.json --assert file`

```
node_modules/optional-parent/package.json: file
```

## `vpt stat-file node_modules/optional-parent/node_modules/is-number/package.json --assert missing`

```
node_modules/optional-parent/node_modules/is-number/package.json: missing
```

## `vpt stat-file node_modules/is-number/package.json --assert file`

```
node_modules/is-number/package.json: file
```

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "command-install-npm11",
"name": "command-install-npm",
"version": "1.0.0",
"private": true,
"packageManager": "npm@11.16.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[[case]]
name = "npm_install_includes_dev"
vp = "global"
env = { npm_config_audit = "false", npm_config_fund = "false", NODE_ENV = "production" }
steps = [
{ argv = ["vpt", "json-edit", "package.json", "dependencies.prod-only-fixture", "file:./prod-dep"], snapshot = false },
{ argv = ["vpt", "json-edit", "package.json", "devDependencies.dev-only-fixture", "file:./dev-dep"], snapshot = false },
{ argv = ["vp", "install", "--dev", "--ignore-scripts"], comment = "include dev dependencies despite NODE_ENV=production without excluding production dependencies" },
["vpt", "stat-file", "node_modules/prod-only-fixture/package.json", "--assert", "file"],
["vpt", "stat-file", "node_modules/dev-only-fixture/package.json", "--assert", "file"],
{ argv = ["vpt", "write-file", "node_modules/preserved.txt", "keep"], snapshot = false },
{ argv = ["vp", "install", "--dev", "--frozen-lockfile", "--ignore-scripts", "--silent"], comment = "npm ci also includes dev dependencies and performs its native cleanup" },
["vpt", "stat-file", "node_modules/preserved.txt", "--assert", "missing"],
["vpt", "stat-file", "node_modules/dev-only-fixture/package.json", "--assert", "file"],
["vpt", "print-file", "package.json", "package-lock.json"],
]

[[case]]
name = "npm6_dependency_filters_install"
vp = "global"
env = { npm_config_audit = "false", npm_config_fund = "false" }
steps = [
{ argv = ["vpt", "json-edit", "package.json", "packageManager", "npm@6.14.18"], snapshot = false },
{ argv = ["vpt", "json-edit", "package.json", "dependencies.prod-only-fixture", "file:./prod-dep"], snapshot = false },
{ argv = ["vpt", "json-edit", "package.json", "devDependencies.dev-only-fixture", "file:./dev-dep"], snapshot = false },
{ argv = ["vpt", "json-edit", "package.json", "optionalDependencies.is-number", "6.0.0"], snapshot = false },
{ argv = ["vp", "install", "-P", "--ignore-scripts", "--silent"], comment = "npm 6 uses --production to omit dev dependencies" },
["vpt", "stat-file", "node_modules/prod-only-fixture/package.json", "--assert", "file"],
["vpt", "stat-file", "node_modules/dev-only-fixture/package.json", "--assert", "missing"],
["vpt", "stat-file", "node_modules/is-number/package.json", "--assert", "file"],
{ argv = ["vp", "install", "-D", "--frozen-lockfile", "--ignore-scripts", "--silent"], envs = [["NODE_ENV", "production"], ["npm_config_production", "true"]], comment = "npm 6 ci includes dev dependencies despite production settings" },
["vpt", "stat-file", "node_modules/dev-only-fixture/package.json", "--assert", "file"],
{ argv = ["vpt", "rm", "-rf", "node_modules"], snapshot = false },
["vp", "install", "--no-optional", "--ignore-scripts", "--silent"],
["vpt", "stat-file", "node_modules/is-number/package.json", "--assert", "missing"],
["vpt", "stat-file", "node_modules/dev-only-fixture/package.json", "--assert", "file"],
["vp", "install", "-P", "--no-optional", "--frozen-lockfile", "--ignore-scripts", "--silent"],
["vpt", "stat-file", "node_modules/dev-only-fixture/package.json", "--assert", "missing"],
["vpt", "stat-file", "node_modules/is-number/package.json", "--assert", "missing"],
{ argv = ["vp", "install", "-P", "-D", "--ignore-scripts", "--silent"], envs = [["NODE_ENV", "production"]], comment = "explicit inclusion wins when both dependency flags are supplied" },
["vpt", "stat-file", "node_modules/dev-only-fixture/package.json", "--assert", "file"],
{ argv = ["vp", "install", "-P", "-D", "--no-optional", "--frozen-lockfile", "--ignore-scripts", "--silent"], envs = [["NODE_ENV", "production"]] },
["vpt", "stat-file", "node_modules/prod-only-fixture/package.json", "--assert", "file"],
["vpt", "stat-file", "node_modules/dev-only-fixture/package.json", "--assert", "file"],
["vpt", "stat-file", "node_modules/is-number/package.json", "--assert", "missing"],
]
Loading
Loading