From 1c5b329ed673f5503293996572af588b9667969a Mon Sep 17 00:00:00 2001 From: Julien Ganichot Date: Mon, 13 Nov 2023 13:06:39 +0100 Subject: [PATCH] fix: test --- .github/workflows/continuous-integration.yaml | 2 ++ src/release.spec.ts | 10 ++++++++++ src/release.ts | 1 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 4b4132b94..1683958cd 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -78,6 +78,8 @@ jobs: node-version-file: '.nvmrc' registry-url: 'https://npm.pkg.github.com' - name: Install dependencies + env: + GITHUB_EVENT_NAME: push run: npm ci --ignore-scripts --no-audit --no-progress --prefer-offline - name: Test run: npm run test:ci diff --git a/src/release.spec.ts b/src/release.spec.ts index 685e05296..2bf1c8423 100644 --- a/src/release.spec.ts +++ b/src/release.spec.ts @@ -3,6 +3,8 @@ import { $ } from 'execa'; import { gitCommits, gitPush, gitRepo } from './utilities/git.js'; +jest.setTimeout(10_000); + const execSpy = jest.fn() as unknown as jest.SpiedFunction< (typeof import('@actions/exec'))['exec'] >; @@ -34,6 +36,13 @@ const optionsOverride = { verifyRelease: (jest.fn() as JestSpyBooleanPromise).mockResolvedValue(true), }; +beforeAll((): void => { + // eslint-disable-next-line functional/immutable-data + process.env.GITHUB_EVENT_NAME = 'push'; + // eslint-disable-next-line functional/immutable-data + process.env.GITHUB_REF = 'master'; +}); + beforeEach(async (): Promise => { await $`git config --global init.defaultBranch master`; @@ -103,6 +112,7 @@ describe('release', (): void => { // Generate git const { cwd } = await gitRepo(); + await gitCommits( ['feat: add a major change\n\nBREAKING CHANGE: break something'], { cwd }, diff --git a/src/release.ts b/src/release.ts index 3d14ef8f0..94bb50804 100644 --- a/src/release.ts +++ b/src/release.ts @@ -31,7 +31,6 @@ export const release = async ( /* istanbul ignore next */ const defaultOptions = { ...(branches === undefined ? {} : { branches }), - ci: false, dryRun: processInputDryRun(), plugins: generatePlugins({ commitAssets: processInputCommitAssets(),