Skip to content

Commit 6ad0d90

Browse files
fix: pass mode to yarn up --recursive (#5517)
**What's the problem this PR addresses?** <!-- Describe the rationale of your PR. --> <!-- Link all issues that it closes. (Closes/Resolves #xxxx.) --> While reviewing #5509, I noticed that the `--mode` flag wasn't passed to `yarn up --recursive`. The issue started in #2913, when the flag was originally introduced. **How did you fix it?** <!-- A detailed description of your implementation. --> Made it pass `--mode` to `yarn up --recursive` and added tests. **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [X] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [X] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [X] I will check that all automated PR checks pass before the PR gets reviewed. --------- Co-authored-by: Maël Nison <[email protected]>
1 parent 165b76d commit 6ad0d90

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

.yarn/versions/5ee1a872.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
releases:
2+
"@yarnpkg/cli": patch
3+
"@yarnpkg/plugin-essentials": patch
4+
5+
declined:
6+
- "@yarnpkg/plugin-compat"
7+
- "@yarnpkg/plugin-constraints"
8+
- "@yarnpkg/plugin-dlx"
9+
- "@yarnpkg/plugin-init"
10+
- "@yarnpkg/plugin-interactive-tools"
11+
- "@yarnpkg/plugin-nm"
12+
- "@yarnpkg/plugin-npm-cli"
13+
- "@yarnpkg/plugin-pack"
14+
- "@yarnpkg/plugin-patch"
15+
- "@yarnpkg/plugin-pnp"
16+
- "@yarnpkg/plugin-pnpm"
17+
- "@yarnpkg/plugin-stage"
18+
- "@yarnpkg/plugin-typescript"
19+
- "@yarnpkg/plugin-version"
20+
- "@yarnpkg/plugin-workspace-tools"
21+
- "@yarnpkg/builder"
22+
- "@yarnpkg/core"
23+
- "@yarnpkg/doctor"

packages/acceptance-tests/pkg-tests-specs/sources/commands/up.test.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe(`Commands`, () => {
119119
[`no-deps`]: `1.0.0`,
120120
},
121121
}, async ({path, run, source}) => {
122-
await run(`add`, `-F`, `no-deps@latest`);
122+
await run(`up`, `-F`, `no-deps@latest`);
123123

124124
await expect(xfs.readJsonPromise(ppath.join(path, Filename.manifest))).resolves.toMatchObject({
125125
dependencies: {
@@ -128,5 +128,41 @@ describe(`Commands`, () => {
128128
});
129129
}),
130130
);
131+
132+
test(
133+
`it should skip build scripts when using --mode=skip-build`,
134+
makeTemporaryEnv({
135+
dependencies: {
136+
[`no-deps-scripted`]: `1.0.0`,
137+
},
138+
}, async ({path, run, source}) => {
139+
const {stdout} = await run(`up`, `no-deps-scripted`, `--mode=skip-build`, {
140+
env: {
141+
YARN_ENABLE_INLINE_BUILDS: `1`,
142+
},
143+
});
144+
145+
expect(stdout).not.toContain(`no-deps-scripted@npm:1.0.0 must be built because it never has been before`);
146+
expect(stdout).not.toContain(`STDOUT preinstall out`);
147+
}),
148+
);
149+
150+
test(
151+
`it should skip build scripts when using --mode=skip-build (recursive)`,
152+
makeTemporaryEnv({
153+
dependencies: {
154+
[`no-deps-scripted`]: `1.0.0`,
155+
},
156+
}, async ({path, run, source}) => {
157+
const {stdout} = await run(`up`, `no-deps-scripted`, `--recursive`, `--mode=skip-build`, {
158+
env: {
159+
YARN_ENABLE_INLINE_BUILDS: `1`,
160+
},
161+
});
162+
163+
expect(stdout).not.toContain(`no-deps-scripted@npm:1.0.0 must be built because it never has been before`);
164+
expect(stdout).not.toContain(`STDOUT preinstall out`);
165+
}),
166+
);
131167
});
132168
});

packages/plugin-essentials/sources/commands/up.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export default class UpCommand extends BaseCommand {
145145
stdout: this.context.stdout,
146146
}, {
147147
cache,
148+
mode: this.mode,
148149
});
149150
}
150151

0 commit comments

Comments
 (0)