fix: resolve remaining CI failures - mock test and gh-pages branch
- Fixed n8n-nodes-base mock test by properly handling mocked function overrides - Added automatic gh-pages branch creation in benchmark workflow - Ensured benchmark workflow handles first run without existing gh-pages - Fixed deploy job to handle missing branch gracefully All CI workflows should now pass successfully. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
26
.github/workflows/benchmark.yml
vendored
26
.github/workflows/benchmark.yml
vendored
@@ -52,6 +52,22 @@ jobs:
|
|||||||
benchmark-results-formatted.json
|
benchmark-results-formatted.json
|
||||||
benchmark-summary.json
|
benchmark-summary.json
|
||||||
|
|
||||||
|
# Ensure gh-pages branch exists
|
||||||
|
- name: Check and create gh-pages branch
|
||||||
|
run: |
|
||||||
|
git fetch origin gh-pages:gh-pages 2>/dev/null || {
|
||||||
|
echo "gh-pages branch doesn't exist. Creating it..."
|
||||||
|
git checkout --orphan gh-pages
|
||||||
|
git rm -rf .
|
||||||
|
echo "# Benchmark Results" > README.md
|
||||||
|
git add README.md
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git commit -m "Initial gh-pages commit"
|
||||||
|
git push origin gh-pages
|
||||||
|
git checkout -
|
||||||
|
}
|
||||||
|
|
||||||
# Store benchmark results and compare
|
# Store benchmark results and compare
|
||||||
- name: Store benchmark result
|
- name: Store benchmark result
|
||||||
uses: benchmark-action/github-action-benchmark@v1
|
uses: benchmark-action/github-action-benchmark@v1
|
||||||
@@ -132,6 +148,16 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: gh-pages
|
ref: gh-pages
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
# If gh-pages checkout failed, create a minimal structure
|
||||||
|
- name: Ensure gh-pages content exists
|
||||||
|
run: |
|
||||||
|
if [ ! -f "index.html" ]; then
|
||||||
|
echo "Creating minimal gh-pages structure..."
|
||||||
|
mkdir -p benchmarks
|
||||||
|
echo '<!DOCTYPE html><html><head><title>n8n-mcp Benchmarks</title></head><body><h1>n8n-mcp Benchmarks</h1><p>Benchmark data will appear here after the first run.</p></body></html>' > index.html
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@v4
|
uses: actions/configure-pages@v4
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ class WorkflowService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mock the module at the top level
|
// Mock the module at the top level
|
||||||
vi.mock('n8n-nodes-base', () => ({
|
vi.mock('n8n-nodes-base', () => {
|
||||||
getNodeTypes: vi.fn(() => {
|
const { getNodeTypes: mockGetNodeTypes } = require('../__mocks__/n8n-nodes-base');
|
||||||
const { getNodeTypes } = require('../__mocks__/n8n-nodes-base');
|
return {
|
||||||
return getNodeTypes();
|
getNodeTypes: mockGetNodeTypes
|
||||||
})
|
};
|
||||||
}));
|
});
|
||||||
|
|
||||||
describe('WorkflowService with n8n-nodes-base mock', () => {
|
describe('WorkflowService with n8n-nodes-base mock', () => {
|
||||||
let service: WorkflowService;
|
let service: WorkflowService;
|
||||||
@@ -173,8 +173,11 @@ describe('WorkflowService with n8n-nodes-base mock', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle missing slack node', async () => {
|
it('should handle missing slack node', async () => {
|
||||||
|
// Save the original mock implementation
|
||||||
|
const originalImplementation = vi.mocked(getNodeTypes).getMockImplementation();
|
||||||
|
|
||||||
// Override getNodeTypes to return undefined for slack
|
// Override getNodeTypes to return undefined for slack
|
||||||
const getNodeTypes = vi.fn(() => ({
|
vi.mocked(getNodeTypes).mockImplementation(() => ({
|
||||||
getByName: vi.fn((name: string) => {
|
getByName: vi.fn((name: string) => {
|
||||||
if (name === 'slack') return undefined;
|
if (name === 'slack') return undefined;
|
||||||
return null;
|
return null;
|
||||||
@@ -182,11 +185,14 @@ describe('WorkflowService with n8n-nodes-base mock', () => {
|
|||||||
getByNameAndVersion: vi.fn()
|
getByNameAndVersion: vi.fn()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mocked(require('n8n-nodes-base').getNodeTypes).mockImplementation(getNodeTypes);
|
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
service.validateSlackMessage('#general', 'Hello')
|
service.validateSlackMessage('#general', 'Hello')
|
||||||
).rejects.toThrow('Slack node not found');
|
).rejects.toThrow('Slack node not found');
|
||||||
|
|
||||||
|
// Restore the original implementation
|
||||||
|
if (originalImplementation) {
|
||||||
|
vi.mocked(getNodeTypes).mockImplementation(originalImplementation);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user