diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 1aeea16..9d46ca5 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -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 diff --git a/@bellatrix/core/src/test/vitest.ts b/@bellatrix/core/src/test/vitest.ts index d7f29d2..1d5a6ad 100644 --- a/@bellatrix/core/src/test/vitest.ts +++ b/@bellatrix/core/src/test/vitest.ts @@ -34,7 +34,7 @@ export function SuiteDecorator(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(.*)`); @@ -42,14 +42,14 @@ export function SuiteDecorator(target: ParameterlessCto const currentTestName = (match?.length ?? 0) > 1 ? match![1] : ''; setCurrentTest(currentTestName, testClassInstance[currentTestName as keyof T] as (...args: unknown[]) => (Promise | 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 () => { diff --git a/@bellatrix/runner/bellatrix.js b/@bellatrix/runner/bellatrix.js index 5546bc9..9addb1c 100755 --- a/@bellatrix/runner/bellatrix.js +++ b/@bellatrix/runner/bellatrix.js @@ -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'; diff --git a/example/bellatrix.config.ts b/example/bellatrix.config.ts index 48d6ed3..3fd98f7 100644 --- a/example/bellatrix.config.ts +++ b/example/bellatrix.config.ts @@ -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 @@ -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/' },