test: added e2e test, improved unit test
This commit is contained in:
parent
c73bf9098a
commit
0c618ceb2e
2 changed files with 40 additions and 2 deletions
38
.github/workflows/e2e-cache.yml
vendored
38
.github/workflows/e2e-cache.yml
vendored
|
@ -135,6 +135,44 @@ jobs:
|
||||||
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
||||||
shell: bash
|
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:
|
yarn-subprojects:
|
||||||
name: Test yarn subprojects
|
name: Test yarn subprojects
|
||||||
strategy:
|
strategy:
|
||||||
|
|
|
@ -277,13 +277,13 @@ describe('main tests', () => {
|
||||||
it('should not enable corepack when no input', async () => {
|
it('should not enable corepack when no input', async () => {
|
||||||
inputs['corepack'] = '';
|
inputs['corepack'] = '';
|
||||||
await main.run();
|
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 () => {
|
it('should not enable corepack when input is "false"', async () => {
|
||||||
inputs['corepack'] = 'false';
|
inputs['corepack'] = 'false';
|
||||||
await main.run();
|
await main.run();
|
||||||
expect(getCommandOutputSpy).not.toHaveBeenCalledWith('corepack');
|
expect(getCommandOutputSpy).not.toHaveBeenCalledWith(expect.stringContaining('corepack'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should enable corepack when input is "true"', async () => {
|
it('should enable corepack when input is "true"', async () => {
|
||||||
|
|
Loading…
Reference in a new issue