From 9abc406d4a042bddc12dbd54a2a125349d7b9ec2 Mon Sep 17 00:00:00 2001 From: Jacek Wielemborek Date: Mon, 27 Oct 2025 20:01:14 +0000 Subject: [PATCH] Revert "test: add verification script for ENABLE_TESTS mechanism" This reverts commit 655b3b01ff9fa61fdb0e6eabedd07d02591f9dbb. --- tests/verify-enable-tests.sh | 124 ----------------------------------- 1 file changed, 124 deletions(-) delete mode 100755 tests/verify-enable-tests.sh diff --git a/tests/verify-enable-tests.sh b/tests/verify-enable-tests.sh deleted file mode 100755 index a2759e8..0000000 --- a/tests/verify-enable-tests.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Verification script for ENABLE_TESTS functionality -# This script tests that the extension behaves correctly with and without ENABLE_TESTS - -set -e - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color - -echo "===================================" -echo "ENABLE_TESTS Verification Script" -echo "===================================" -echo "" - -# Function to run test and capture result -run_test() { - local test_name="$1" - echo "Running: $test_name" - - # Check if test-content-script.js exists in lib/tests/ - if [ -f "lib/tests/test-content-script.js" ]; then - echo " ✓ test-content-script.js found in lib/tests/" - else - echo " ✗ test-content-script.js NOT found in lib/tests/" - fi - - # Check if ENABLE_TESTS condition in background.js - if grep -q 'if (false)' lib/background.js 2>/dev/null; then - echo " ✓ Test code is disabled (if (false) found)" - elif grep -q 'if (true)' lib/background.js 2>/dev/null; then - echo " ✓ Test code is enabled (if (true) found)" - else - echo " ? Could not determine test code state" - fi - - # If we had Docker working, we would run the actual test here - # python3 tests/test_verify.py 2>&1 | tail -5 - # For now, we just check the build artifacts - - echo "" -} - -# Clean previous builds -echo "Cleaning previous builds..." -rm -rf lib/ -echo "" - -# Test 1: Production build (without ENABLE_TESTS) -echo -e "${YELLOW}TEST 1: Production Build (without ENABLE_TESTS)${NC}" -echo "================================================" -npm run build > /dev/null 2>&1 -run_test "Production Build" - -# Expected: -# - lib/tests/ should NOT exist -# - background.js should have 'if (false)' -if [ ! -d "lib/tests" ] && grep -q 'if (false)' lib/background.js 2>/dev/null; then - echo -e "${GREEN}✓ PASS: Production build correctly excludes test code${NC}" -else - echo -e "${RED}✗ FAIL: Production build still contains test code${NC}" -fi -echo "" - -# Clean for next test -rm -rf lib/ - -# Test 2: Test build (with ENABLE_TESTS=true) -echo -e "${YELLOW}TEST 2: Test Build (with ENABLE_TESTS=true)${NC}" -echo "=============================================" -ENABLE_TESTS=true npm run build > /dev/null 2>&1 -run_test "Test Build" - -# Expected: -# - lib/tests/test-content-script.js should exist -# - background.js should have 'if (true)' -if [ -f "lib/tests/test-content-script.js" ] && grep -q 'if (true)' lib/background.js 2>/dev/null; then - echo -e "${GREEN}✓ PASS: Test build correctly includes test code${NC}" -else - echo -e "${RED}✗ FAIL: Test build missing test code${NC}" -fi -echo "" - -# Summary -echo "===================================" -echo "SUMMARY" -echo "===================================" -echo "" - -# Check both conditions for final verdict -PROD_OK=false -TEST_OK=false - -# Re-test production build -rm -rf lib/ -npm run build > /dev/null 2>&1 -if [ ! -d "lib/tests" ] && grep -q 'if (false)' lib/background.js 2>/dev/null; then - PROD_OK=true -fi - -# Re-test test build -rm -rf lib/ -ENABLE_TESTS=true npm run build > /dev/null 2>&1 -if [ -f "lib/tests/test-content-script.js" ] && grep -q 'if (true)' lib/background.js 2>/dev/null; then - TEST_OK=true -fi - -if $PROD_OK && $TEST_OK; then - echo -e "${GREEN}✓ SUCCESS: ENABLE_TESTS mechanism works correctly!${NC}" - echo " - Production builds exclude test code" - echo " - Test builds include test code" - exit 0 -else - echo -e "${RED}✗ FAILURE: ENABLE_TESTS mechanism has issues${NC}" - if ! $PROD_OK; then - echo " - Production build problem detected" - fi - if ! $TEST_OK; then - echo " - Test build problem detected" - fi - exit 1 -fi \ No newline at end of file