Files
gitea-ci-library/tests/features/step_definitions/common.steps.js
T
moilanik cd6ff8830c
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 27s
acc-tests Cucumber test report
CI Feature / Cucumber tests (push) Failing after 51s
unit-tests Bats test report
CI Feature / Bats tests (push) Failing after 1m32s
CI Feature / Report Summary (push) Successful in 5s
testien nopeutus
2026-06-20 13:44:36 +03:00

35 lines
1.0 KiB
JavaScript

const { execSync, spawn } = require('child_process');
const { Before, After, Given } = require('@cucumber/cucumber');
const path = require('path');
const PROJECT_ROOT = path.resolve(__dirname, '..', '..', '..');
const MOCK_SCRIPT = path.join(PROJECT_ROOT, 'tests', 'helpers', 'mock-api.sh');
Before({ tags: '@mock' }, function () {
const out = execSync(`bash -o pipefail -c 'source "${MOCK_SCRIPT}" && mock_start >&2 && echo "$GITEA_API_URL"'`, {
cwd: PROJECT_ROOT,
encoding: 'utf-8',
stdio: ['pipe', 'pipe', 'pipe'],
});
const apiUrl = out.trim();
if (!apiUrl.startsWith('http')) {
throw new Error(`Mock server failed to start (no API URL: ${apiUrl})`);
}
process.env.GITEA_API_URL = apiUrl;
});
After({ tags: '@mock' }, function () {
try {
execSync(`bash -c 'source "${MOCK_SCRIPT}" && mock_stop'`, {
cwd: PROJECT_ROOT,
stdio: 'ignore',
});
} catch (_) { /* ignore */ }
});
Given('a project repository exists in Gitea', function () {
});
Given('a commit has been pushed to the repository', function () {
});