51922e2954
POST build status to Gitea REST API. Supports pending, success, failure, error states. Cross-repo reporting via optional root_commit and root_repo parameters. Includes mock Gitea API server shared between bats unit tests and cucumber acceptance tests.
29 lines
792 B
JavaScript
29 lines
792 B
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 () {
|
|
execSync(`bash -c 'source "${MOCK_SCRIPT}" && mock_start'`, {
|
|
cwd: PROJECT_ROOT,
|
|
stdio: 'ignore',
|
|
});
|
|
});
|
|
|
|
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 () {
|
|
});
|