diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f301f7..d064b7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,7 +111,7 @@ jobs: run: npm ci --prefer-offline --no-audit - name: Generate test coverage - run: jest --coverage --testPathPattern='test/(unit|integration).*\.test\.js$' + run: npx jest --coverage --testPathPattern='test/(unit|integration).*\.test\.js$' env: NODE_ENV: test BOT_USERNAME: '@TestBot' diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7ee1984..4001b4a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,7 +37,7 @@ jobs: run: npm ci --prefer-offline --no-audit - name: Run linter - run: npm run lint + run: npm run lint:check - name: Run tests run: npm test diff --git a/test/e2e/utils/testHelpers.js b/test/e2e/utils/testHelpers.js index 933de06..3b60334 100644 --- a/test/e2e/utils/testHelpers.js +++ b/test/e2e/utils/testHelpers.js @@ -81,32 +81,28 @@ function conditionalDescribe(suiteName, suiteFunction, options = {}) { const { dockerImage, requiredEnvVars = [] } = options; describe(suiteName, () => { - let shouldSkip = false; - beforeAll(async () => { // Check Docker image if (dockerImage) { - shouldSkip = await skipIfDockerImageMissing(dockerImage); + const imageExists = await dockerImageExists(dockerImage); + if (!imageExists) { + console.warn(`⚠️ Skipping test suite '${suiteName}': Docker image '${dockerImage}' not found`); + throw new Error(`Docker image '${dockerImage}' not found - skipping tests`); + } } // Check environment variables - if (!shouldSkip && requiredEnvVars.length > 0) { - shouldSkip = skipIfEnvVarsMissing(requiredEnvVars); - } - - if (shouldSkip) { - console.log(`Skipping entire test suite: ${suiteName}`); + if (requiredEnvVars.length > 0) { + const { missing, hasAll } = checkRequiredEnvVars(requiredEnvVars); + if (!hasAll) { + console.warn(`⚠️ Skipping test suite '${suiteName}': Missing environment variables: ${missing.join(', ')}`); + throw new Error(`Missing environment variables: ${missing.join(', ')} - skipping tests`); + } } }); - // Run the actual tests if not skipping - if (!shouldSkip) { - suiteFunction(); - } else { - test('Skipped due to missing requirements', () => { - console.log('Test suite was skipped'); - }); - } + // Run the actual test suite + suiteFunction(); }); }