|
1 | 1 | #!/bin/bash |
2 | 2 | set -e |
3 | 3 |
|
| 4 | +# Get the absolute path of the script's directory |
| 5 | +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" |
4 | 6 | CLI_PATH="$(pwd)/cli-v2" |
5 | 7 |
|
| 8 | +echo "Script directory: $SCRIPT_DIR" |
| 9 | +echo "Current working directory: $(pwd)" |
| 10 | + |
6 | 11 | # Check if API token is provided for token-based test |
7 | 12 | if [ -z "$CODACY_API_TOKEN" ]; then |
8 | 13 | echo "Warning: CODACY_API_TOKEN environment variable is not set. Token-based test will be skipped." |
@@ -56,7 +61,17 @@ run_init_test() { |
56 | 61 | local use_token="$3" |
57 | 62 |
|
58 | 63 | echo "Running test: $test_name" |
| 64 | + echo "Test directory: $test_dir" |
| 65 | + |
| 66 | + # Check if test directory exists |
| 67 | + if [ ! -d "$test_dir" ]; then |
| 68 | + echo "❌ Test directory does not exist: $test_dir" |
| 69 | + ls -la "$(dirname "$test_dir")" |
| 70 | + exit 1 |
| 71 | + fi |
| 72 | + |
59 | 73 | cd "$test_dir" || exit 1 |
| 74 | + echo "Changed to directory: $(pwd)" |
60 | 75 |
|
61 | 76 | # Clean up any existing .codacy directory |
62 | 77 | rm -rf .codacy |
@@ -84,10 +99,10 @@ echo "Starting integration tests..." |
84 | 99 | echo "----------------------------------------" |
85 | 100 |
|
86 | 101 | # Test 1: Init without token |
87 | | -run_init_test "integration-tests/init-without-token" "init-without-token" "false" |
| 102 | +run_init_test "$SCRIPT_DIR/init-without-token" "init-without-token" "false" |
88 | 103 |
|
89 | 104 | # Test 2: Init with token |
90 | | -run_init_test "integration-tests/init-with-token" "init-with-token" "true" |
| 105 | +run_init_test "$SCRIPT_DIR/init-with-token" "init-with-token" "true" |
91 | 106 |
|
92 | 107 | echo "All tests completed successfully! 🎉" |
93 | 108 |
|
0 commit comments