Skip to content

added example CI pipeline #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI
name: Example Tests CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
build:
test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.6
- name: Checkout the repository
uses: actions/checkout@v4

- name: Set up Node.js version 20.9.0 (minumum supported)
uses: actions/setup-node@v4
with:
node-version: 20.6
node-version: 20.9.0
cache: 'npm'
- run: npm ci
working-directory: example
- run: npm test

- name: Install Node.js dependencies
run: npm ci

- name: Run tests in the example directory
run: npm test
working-directory: ./example
continue-on-error: true

- name: Report test results
uses: dorny/test-reporter@v1.9.1
with:
name: results
path: './example/reports/result.xml'
reporter: java-junit
8 changes: 4 additions & 4 deletions @bellatrix/core/src/test/vitest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ export function SuiteDecorator<T extends BellatrixTest>(target: ParameterlessCto
const title = target.name; // or passed as @Suite('title') or similar

nativeLibrary.describe(title, () => {
nativeLibrary.beforeAll(async () => await testClassSymbolMethods.beforeAll.call(testClassInstance));
nativeLibrary.beforeAll(async () => await testClassSymbolMethods.beforeAll.call(testClassInstance), 0);

nativeLibrary.beforeEach(async () => {
const regex = new RegExp(`.*\\b.* > ${title} > \\b(.*)`);
const match = regex.exec(nativeLibrary.expect.getState().currentTestName ?? '');
const currentTestName = (match?.length ?? 0) > 1 ? match![1] : '';
setCurrentTest(currentTestName, testClassInstance[currentTestName as keyof T] as (...args: unknown[]) => (Promise<void> | void), testClass.constructor);
await testClassSymbolMethods.beforeEach.call(testClassInstance);
});
}, 0);

nativeLibrary.afterEach(async () => {
await testClassSymbolMethods.afterEach.call(testClassInstance);
unsetCurrentTest(testClass.constructor);
});
}, 0);

nativeLibrary.afterAll(async () => await testClassSymbolMethods.afterAll.call(testClassInstance));
nativeLibrary.afterAll(async () => await testClassSymbolMethods.afterAll.call(testClassInstance), 0);

for (const testMethod of testMethods) {
nativeLibrary.test(testMethod, async () => {
Expand Down
4 changes: 2 additions & 2 deletions @bellatrix/runner/bellatrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
console.log('DEBUG: starting bellatrix'); // DEBUG

const nodeVersion = process.versions.node.split('.');
if (parseInt(nodeVersion[0].replace()) < 20 || (parseInt(nodeVersion[0]) == 20 && parseInt(nodeVersion[1]) < 6)) {
throw Error(`You need Node runtime version 20.6.0 minimum. Current version: ${process.versions.node}`);
if (parseInt(nodeVersion[0].replace()) < 20 || (parseInt(nodeVersion[0]) == 20 && parseInt(nodeVersion[1]) < 9)) {
throw Error(`You need Node runtime version 20.9.0 minimum. Current version: ${process.versions.node}`);
}

import { spawnSync } from 'child_process';
Expand Down
8 changes: 4 additions & 4 deletions example/bellatrix.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const config: BellatrixConfigurationOverride = {
testSettings: {
testTimeout: 300000,
testFramework: 'vitest', // vitest, jasmine, mocha, jest, playwright
testReporter: 'console-only',
testReporter: 'junit',
testReportDirectory: './reports',
testReportName: `result`,
parallelExecution: false, // not functional yet
Expand All @@ -29,9 +29,9 @@ const config: BellatrixConfigurationOverride = {
executionSettings: {
browserAutomationTool: 'playwright', // playwright, selenium
browser: 'edge', // chrome, firefox, safari, edge
// viewport: { width: 1920, height: 1080 },
startMaximized: true,
headless: false,
viewport: { width: 1920, height: 1080 },
startMaximized: false,
headless: true,
executionType: 'local', // remote
baseUrl: 'https://demos.bellatrix.solutions/'
},
Expand Down
Loading