Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to enable corepack #901

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
test: added e2e test, improved unit test
  • Loading branch information
jrparish committed Feb 6, 2024
commit 0c618ceb2e48275dc06e86901822fd966ce75ba2
38 changes: 38 additions & 0 deletions .github/workflows/e2e-cache.yml
Original file line number Diff line number Diff line change
@@ -135,6 +135,44 @@ jobs:
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
shell: bash

node-yarn4-corepack-dependencies-caching:
name: Test yarn 4 (Node ${{ matrix.node-version}}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18, 20]
steps:
- uses: actions/checkout@v4
- name: Update yarn
run: yarn set version 4.1.0
- name: Yarn version
run: yarn --version
- name: Generate simple .yarnrc.yml
run: |
echo "nodeLinker: node-modules" >> .yarnrc.yml
- name: Generate yarn file
run: yarn install
- name: Remove dependencies
shell: pwsh
run: Remove-Item node_modules -Force -Recurse
- name: Clean global cache
run: yarn cache clean --all
- name: Setup Node
uses: ./
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
corepack: true
- name: Install dependencies
run: yarn install
- name: Verify node and yarn
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
shell: bash

yarn-subprojects:
name: Test yarn subprojects
strategy:
4 changes: 2 additions & 2 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -277,13 +277,13 @@ describe('main tests', () => {
it('should not enable corepack when no input', async () => {
inputs['corepack'] = '';
await main.run();
expect(getCommandOutputSpy).not.toHaveBeenCalledWith('corepack');
expect(getCommandOutputSpy).not.toHaveBeenCalledWith(expect.stringContaining('corepack'));
});

it('should not enable corepack when input is "false"', async () => {
inputs['corepack'] = 'false';
await main.run();
expect(getCommandOutputSpy).not.toHaveBeenCalledWith('corepack');
expect(getCommandOutputSpy).not.toHaveBeenCalledWith(expect.stringContaining('corepack'));
});

it('should enable corepack when input is "true"', async () => {