@@ -243,6 +243,55 @@ jobs:
243243 exit 1
244244 fi
245245
246+ test-package-manager :
247+ strategy :
248+ fail-fast : false
249+ matrix :
250+ os : [ubuntu-latest, macos-latest, windows-latest]
251+ config :
252+ - input : " true"
253+ modes : ' ["managed", "managed", "managed", "managed"]'
254+ - input : " false"
255+ modes : ' ["system_first", "system_first", "system_first", "system_first"]'
256+ - input : " {npm: false, pnpm: true, yarn: false}"
257+ modes : ' ["system_first", "managed", "system_first", "managed"]'
258+ runs-on : ${{ matrix.os }}
259+ steps :
260+ - uses : taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
261+
262+ - name : Setup Vite+ with package-manager configuration
263+ uses : ./
264+ with :
265+ package-manager : ${{ matrix.config.input }}
266+ run-install : false
267+ cache : false
268+
269+ # Query the real CLI so this covers input parsing, installation, and mode
270+ # changes, including true and omitted entries in a partial mapping.
271+ - name : Verify package-manager modes and independent Node.js management
272+ shell : bash
273+ env :
274+ EXPECTED_MODES : ${{ matrix.config.modes }}
275+ run : |
276+ node --input-type=module <<'NODE'
277+ import assert from 'node:assert/strict';
278+ import { execFileSync } from 'node:child_process';
279+
280+ const managers = ['npm', 'pnpm', 'yarn', 'bun'];
281+ const modes = JSON.parse(process.env.EXPECTED_MODES);
282+ for (const [index, manager] of managers.entries()) {
283+ const { package_manager: current } = JSON.parse(
284+ execFileSync('vp', ['env', 'current', manager, '--json'], { encoding: 'utf8' }),
285+ );
286+ console.log(`${manager}: ${current.mode}`);
287+ assert.equal(current.mode, modes[index], `${manager} mode`);
288+ }
289+ const { node } = JSON.parse(
290+ execFileSync('vp', ['env', 'current', 'node', '--json'], { encoding: 'utf8' }),
291+ );
292+ assert.equal(node.mode, 'managed', 'Node.js management must remain enabled');
293+ NODE
294+
246295 test-default-version :
247296 # End-to-end check of the default version-resolution logic: with no `version`
248297 # or `version-file` input, the action auto-detects the vite-plus version from
0 commit comments