diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 9919b566ed..80bcaa3130 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -136,6 +136,9 @@ jobs: echo "=== Final coverage directory contents ===" ls -la ./redisinsight/api/test/test-runs/coverage/ || echo "Coverage directory does not exist!" echo "" + echo "=== Nyc coverage directory contents ===" + ls -la ./redisinsight/api/test/test-runs/coverage/.nyc_output || echo "Nyc directory does not exist!" + echo "" echo "=== File verification ===" if [ -f "./redisinsight/api/test/test-runs/coverage/test-run-result.json" ]; then echo "✅ Test results file exists! File size:" @@ -161,52 +164,21 @@ jobs: - name: Debug NYC coverage generation if: always() run: | - echo "=== Debugging missing test-run-coverage.json file ===" + echo "=== Debugging NYC merge process ===" echo "Working directory: $(pwd)" echo "" - echo "=== Check .nyc_output directory in API folder (HOST) ===" - cd ./redisinsight/api - if [ -d ".nyc_output" ]; then - echo "✅ .nyc_output directory exists on host" - echo "Contents:" - ls -la .nyc_output - echo "File count: $(find .nyc_output -name "*.json" | wc -l)" - echo "Sample file content (first 5 lines):" - find .nyc_output -name "*.json" | head -1 | xargs head -5 2>/dev/null || echo "No JSON files to sample" - else - echo "❌ .nyc_output directory does not exist on host!" - fi - echo "" - echo "=== Check .nyc_output directory in DOCKER CONTAINER ===" - cd /home/runner/work/RedisInsight/RedisInsight - export COV_FOLDER="./redisinsight/api/test/test-runs/coverage" - export ID="debug-test" - export RTE="debug" + echo "=== Try manual NYC merge on HOST ===" cd ./redisinsight/api/test/test-runs - echo "Running debug command inside container to check .nyc_output..." - if [ -f "./docker.build.yml" ]; then - echo "Using Docker build..." - echo "Command: docker-compose -f ./docker.build.yml -f ./docker.build.env exec test ls -la /usr/src/app/.nyc_output" - docker-compose -f ./docker.build.yml --env-file ./docker.build.env exec test ls -la /usr/src/app/.nyc_output 2>/dev/null || echo "Container not running or .nyc_output not found in container" - else - echo "Docker compose file not found" - fi - echo "" - echo "=== Try manual NYC merge in HOST ===" - cd /home/runner/work/RedisInsight/RedisInsight/redisinsight/api - - if [ -d ".nyc_output" ] && [ "$(find .nyc_output -name "*.json" | wc -l)" -gt 0 ]; then + if [ -d "coverage/.nyc_output" ] && [ "$(find coverage/.nyc_output -name "*.json" | wc -l)" -gt 0 ]; then + echo "✅ .nyc_output directory found with $(find coverage/.nyc_output -name "*.json" | wc -l) files" echo "Attempting manual NYC merge..." - echo "Command: nyc merge .nyc_output coverage/test-run-coverage.json" - nyc merge .nyc_output coverage/test-run-coverage.json || echo "NYC merge failed with exit code $?" + echo "Command: cd ../.. && nyc merge ./test/test-runs/coverage/.nyc_output ./test/test-runs/coverage/test-run-coverage.json" + cd ../.. && nyc merge ./test/test-runs/coverage/.nyc_output ./test/test-runs/coverage/test-run-coverage.json || echo "NYC merge failed with exit code $?" echo "Checking result:" - ls -la coverage/test-run-coverage.json 2>/dev/null || echo "File not created" + ls -la ./test/test-runs/coverage/test-run-coverage.json 2>/dev/null || echo "File not created" else - echo "Skipping merge - no coverage data files found" + echo "❌ No coverage data files found in coverage/.nyc_output" fi - echo "" - echo "=== Final coverage directory check ===" - ls -la coverage/ | head -10 - name: Copy test results to artifacts run: | diff --git a/redisinsight/api/package.json b/redisinsight/api/package.json index 7cc7807677..31e16b2729 100644 --- a/redisinsight/api/package.json +++ b/redisinsight/api/package.json @@ -35,7 +35,7 @@ "typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js -d ./config/ormconfig.ts", "test:api": "cross-env NODE_ENV=test ts-mocha --paths --config ./test/api/.mocharc.yml", "test:api:cov": "nyc --reporter=html --reporter=text --reporter=text-summary yarn run test:api", - "test:api:ci:cov": "cross-env nyc -r text -r text-summary -r html yarn run test:api --reporter mocha-multi-reporters --reporter-options configFile=test/api/reporters.json && nyc merge .nyc_output coverage/test-run-coverage.json", + "test:api:ci:cov": "cross-env NODE_ENV=test nyc --temp-dir coverage/.nyc_output --report-dir coverage --instrument -r text -r text-summary -r html yarn run test:api --reporter mocha-multi-reporters --reporter-options configFile=test/api/reporters.json && ls -la coverage/.nyc_output && nyc merge coverage/.nyc_output ./coverage/test-run-coverage.json", "typeorm:migrate": "cross-env NODE_ENV=staging yarn typeorm migration:generate ./migration/migration", "typeorm:run": "yarn typeorm migration:run", "typeorm:run:stage": "cross-env NODE_ENV=staging yarn typeorm migration:run"