test: added e2e test, improved unit test

This commit is contained in:
Jacob Parish 2024-02-06 09:46:03 -06:00
parent c73bf9098a
commit 0c618ceb2e
2 changed files with 40 additions and 2 deletions

View file

@ -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:

View file

@ -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 () => {