mirror of
https://github.com/waku-org/js-waku.git
synced 2025-02-11 11:57:04 +00:00
chore: switch out of allure reporters (#2222)
* chore: switch out of allure * chore: fix config * fix: test file patterns
This commit is contained in:
parent
4b28f250e3
commit
f3aed7074b
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -124,7 +124,7 @@ jobs:
|
||||
with:
|
||||
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'wakuorg/nwaku:v0.31.0' }}
|
||||
test_type: node
|
||||
allure_reports: true
|
||||
debug: waku*
|
||||
|
||||
node_optional:
|
||||
uses: ./.github/workflows/test-node.yml
|
||||
|
56
.github/workflows/test-node.yml
vendored
56
.github/workflows/test-node.yml
vendored
@ -18,24 +18,22 @@ on:
|
||||
required: false
|
||||
type: string
|
||||
default: ''
|
||||
allure_reports:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
NODE_JS: "20"
|
||||
# Ensure test type conditions remain consistent.
|
||||
WAKU_SERVICE_NODE_PARAMS: ${{ (inputs.test_type == 'go-waku-master') && '--min-relay-peers-to-publish=0' || '' }}
|
||||
DEBUG: ${{ inputs.debug }}
|
||||
GITHUB_TOKEN: ${{ secrets.DEPLOY_TEST_REPORTS_PAT }}
|
||||
|
||||
jobs:
|
||||
node:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image }}
|
||||
ALLURE_REPORTS: ${{ inputs.allure_reports }}
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
checks: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
@ -51,38 +49,14 @@ jobs:
|
||||
|
||||
- run: ${{ (inputs.test_type == 'node-optional') && 'npm run test:optional --workspace=@waku/tests' || 'npm run test:node' }}
|
||||
|
||||
- name: Merge allure reports
|
||||
if: always() && env.ALLURE_REPORTS == 'true'
|
||||
run: node ci/mergeAllureResults.cjs
|
||||
|
||||
- name: Get allure history
|
||||
if: always() && env.ALLURE_REPORTS == 'true'
|
||||
uses: actions/checkout@v3
|
||||
continue-on-error: true
|
||||
- name: Test Report
|
||||
uses: dorny/test-reporter@v1
|
||||
if: success() || failure()
|
||||
with:
|
||||
repository: waku-org/allure-jswaku
|
||||
ref: gh-pages
|
||||
path: gh-pages
|
||||
token: ${{ env.GITHUB_TOKEN }}
|
||||
|
||||
- name: Setup allure report
|
||||
if: always() && env.ALLURE_REPORTS == 'true'
|
||||
uses: simple-elf/allure-report-action@master
|
||||
id: allure-report
|
||||
with:
|
||||
allure_results: allure-results
|
||||
gh_pages: gh-pages
|
||||
allure_history: allure-history
|
||||
keep_reports: 30
|
||||
|
||||
- name: Deploy report to Github Pages
|
||||
if: always() && env.ALLURE_REPORTS == 'true'
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
personal_token: ${{ env.GITHUB_TOKEN }}
|
||||
external_repository: waku-org/allure-jswaku
|
||||
publish_branch: gh-pages
|
||||
publish_dir: allure-history
|
||||
name: ${{ inputs.test_type }} Tests
|
||||
path: 'packages/tests/reports/mocha-*.json'
|
||||
reporter: mocha-json
|
||||
fail-on-error: true
|
||||
|
||||
- name: Upload debug logs on failure
|
||||
uses: actions/upload-artifact@v3
|
||||
@ -109,11 +83,3 @@ jobs:
|
||||
with:
|
||||
name: ${{ inputs.test_type }}-logs
|
||||
path: packages/tests/log/
|
||||
|
||||
- name: Create test summary
|
||||
if: always() && env.ALLURE_REPORTS == 'true'
|
||||
run: |
|
||||
echo "## Run Information" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **NWAKU**: ${{ env.WAKUNODE_IMAGE }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Allure report will be available at: https://waku-org.github.io/allure-jswaku/${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,5 +12,4 @@ docs
|
||||
test-results
|
||||
playwright-report
|
||||
example
|
||||
allure-results
|
||||
packages/discovery/mock_local_storage
|
@ -1,19 +0,0 @@
|
||||
const fs = require("fs-extra");
|
||||
const glob = require("glob");
|
||||
|
||||
const ROOT_ALLURE_RESULTS = "./allure-results"; // Target directory in the root
|
||||
|
||||
fs.ensureDirSync(ROOT_ALLURE_RESULTS);
|
||||
|
||||
const directories = glob.sync("packages/**/allure-results");
|
||||
|
||||
directories.forEach((dir) => {
|
||||
const files = fs.readdirSync(dir);
|
||||
files.forEach((file) => {
|
||||
const sourcePath = `${dir}/${file}`;
|
||||
const targetPath = `${ROOT_ALLURE_RESULTS}/${file}`;
|
||||
fs.copyFileSync(sourcePath, targetPath);
|
||||
});
|
||||
});
|
||||
|
||||
console.log("All allure-results directories merged successfully!");
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"reporterEnabled": "spec, allure-mocha",
|
||||
"allureMochaReporter": {
|
||||
"outputDir": "allure-results"
|
||||
}
|
||||
}
|
@ -3,21 +3,22 @@ const config = {
|
||||
spec: 'src/**/*.spec.ts',
|
||||
require: ['ts-node/register', 'isomorphic-fetch'],
|
||||
loader: 'ts-node/esm',
|
||||
nodeOptions: [
|
||||
'node-option': [
|
||||
'experimental-specifier-resolution=node',
|
||||
'loader=ts-node/esm'
|
||||
],
|
||||
exit: true
|
||||
exit: true,
|
||||
retries: 4,
|
||||
};
|
||||
|
||||
if (process.env.CI) {
|
||||
console.log("Running tests in parallel");
|
||||
config.parallel = true;
|
||||
config.jobs = 6;
|
||||
console.log("Activating allure reporting");
|
||||
config.reporter = 'mocha-multi-reporters';
|
||||
console.log("Using JSON reporter for test results");
|
||||
config.reporter = 'json';
|
||||
config.reporterOptions = {
|
||||
configFile: '.mocha.reporters.json'
|
||||
output: 'reports/mocha-results.json'
|
||||
};
|
||||
} else {
|
||||
console.log("Running tests serially. To enable parallel execution update mocha config");
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"reporterEnabled": "spec, allure-mocha",
|
||||
"allureMochaReporter": {
|
||||
"outputDir": "allure-results"
|
||||
}
|
||||
}
|
@ -7,17 +7,18 @@ const config = {
|
||||
'experimental-specifier-resolution=node',
|
||||
'loader=ts-node/esm'
|
||||
],
|
||||
exit: true
|
||||
exit: true,
|
||||
retries: 4
|
||||
};
|
||||
|
||||
if (process.env.CI) {
|
||||
console.log("Running tests in parallel");
|
||||
config.parallel = true;
|
||||
config.jobs = 6;
|
||||
console.log("Activating allure reporting");
|
||||
config.reporter = 'mocha-multi-reporters';
|
||||
console.log("Using JSON reporter for test results");
|
||||
config.reporter = 'json';
|
||||
config.reporterOptions = {
|
||||
configFile: '.mocha.reporters.json'
|
||||
output: 'reports/mocha-results.json'
|
||||
};
|
||||
} else {
|
||||
console.log("Running tests serially. To enable parallel execution update mocha config");
|
||||
|
@ -44,7 +44,7 @@
|
||||
"prepublish": "npm run build",
|
||||
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build",
|
||||
"test": "NODE_ENV=test run-s test:*",
|
||||
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha",
|
||||
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha 'src/**/*.spec.ts'",
|
||||
"test:browser": "NODE_ENV=test karma start karma.conf.cjs"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"reporterEnabled": "spec, allure-mocha",
|
||||
"allureMochaReporter": {
|
||||
"outputDir": "allure-results"
|
||||
}
|
||||
}
|
@ -7,17 +7,18 @@ const config = {
|
||||
'experimental-specifier-resolution=node',
|
||||
'loader=ts-node/esm'
|
||||
],
|
||||
exit: true
|
||||
exit: true,
|
||||
retries: 4
|
||||
};
|
||||
|
||||
if (process.env.CI) {
|
||||
console.log("Running tests in parallel");
|
||||
config.parallel = true;
|
||||
config.jobs = 6;
|
||||
console.log("Activating allure reporting");
|
||||
config.reporter = 'mocha-multi-reporters';
|
||||
console.log("Using JSON reporter for test results");
|
||||
config.reporter = 'json';
|
||||
config.reporterOptions = {
|
||||
configFile: '.mocha.reporters.json'
|
||||
output: 'reports/mocha-results.json'
|
||||
};
|
||||
} else {
|
||||
console.log("Running tests serially. To enable parallel execution update mocha config");
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"reporterEnabled": "spec, allure-mocha",
|
||||
"allureMochaReporter": {
|
||||
"outputDir": "allure-results"
|
||||
}
|
||||
}
|
@ -7,17 +7,18 @@ const config = {
|
||||
'experimental-specifier-resolution=node',
|
||||
'loader=ts-node/esm'
|
||||
],
|
||||
exit: true
|
||||
exit: true,
|
||||
retries: 4
|
||||
};
|
||||
|
||||
if (process.env.CI) {
|
||||
console.log("Running tests in parallel");
|
||||
config.parallel = true;
|
||||
config.jobs = 6;
|
||||
console.log("Activating allure reporting");
|
||||
config.reporter = 'mocha-multi-reporters';
|
||||
console.log("Using JSON reporter for test results");
|
||||
config.reporter = 'json';
|
||||
config.reporterOptions = {
|
||||
configFile: '.mocha.reporters.json'
|
||||
output: 'reports/mocha-results.json'
|
||||
};
|
||||
} else {
|
||||
console.log("Running tests serially. To enable parallel execution update mocha config");
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"reporterEnabled": "spec, allure-mocha",
|
||||
"allureMochaReporter": {
|
||||
"outputDir": "allure-results"
|
||||
}
|
||||
}
|
@ -7,17 +7,18 @@ const config = {
|
||||
'experimental-specifier-resolution=node',
|
||||
'loader=ts-node/esm'
|
||||
],
|
||||
exit: true
|
||||
exit: true,
|
||||
retries: 4
|
||||
};
|
||||
|
||||
if (process.env.CI) {
|
||||
console.log("Running tests in parallel");
|
||||
config.parallel = true;
|
||||
config.jobs = 6;
|
||||
console.log("Activating allure reporting");
|
||||
config.reporter = 'mocha-multi-reporters';
|
||||
console.log("Using JSON reporter for test results");
|
||||
config.reporter = 'json';
|
||||
config.reporterOptions = {
|
||||
configFile: '.mocha.reporters.json'
|
||||
output: 'reports/mocha-results.json'
|
||||
};
|
||||
} else {
|
||||
console.log("Running tests serially. To enable parallel execution update mocha config");
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"reporterEnabled": "spec, allure-mocha",
|
||||
"allureMochaReporter": {
|
||||
"outputDir": "allure-results"
|
||||
}
|
||||
}
|
@ -7,17 +7,18 @@ const config = {
|
||||
'experimental-specifier-resolution=node',
|
||||
'loader=ts-node/esm'
|
||||
],
|
||||
exit: true
|
||||
exit: true,
|
||||
retries: 4
|
||||
};
|
||||
|
||||
if (process.env.CI) {
|
||||
console.log("Running tests in parallel");
|
||||
config.parallel = true;
|
||||
config.jobs = 6;
|
||||
console.log("Activating allure reporting");
|
||||
config.reporter = 'mocha-multi-reporters';
|
||||
console.log("Using JSON reporter for test results");
|
||||
config.reporter = 'json';
|
||||
config.reporterOptions = {
|
||||
configFile: '.mocha.reporters.json'
|
||||
output: 'reports/mocha-results.json'
|
||||
};
|
||||
} else {
|
||||
console.log("Running tests serially. To enable parallel execution update mocha config");
|
||||
|
@ -39,7 +39,7 @@
|
||||
"check:lint": "eslint src *.js",
|
||||
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
|
||||
"test": "NODE_ENV=test run-s test:*",
|
||||
"test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha",
|
||||
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha",
|
||||
"watch:build": "tsc -p tsconfig.json -w",
|
||||
"watch:test": "mocha --watch",
|
||||
"prepublish": "npm run build",
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"reporterEnabled": "spec, allure-mocha",
|
||||
"allureMochaReporter": {
|
||||
"outputDir": "allure-results"
|
||||
}
|
||||
}
|
@ -3,21 +3,22 @@ const config = {
|
||||
spec: 'src/**/*.spec.ts',
|
||||
require: ['ts-node/register', 'isomorphic-fetch'],
|
||||
loader: 'ts-node/esm',
|
||||
nodeOptions: [
|
||||
'node-option': [
|
||||
'experimental-specifier-resolution=node',
|
||||
'loader=ts-node/esm'
|
||||
],
|
||||
exit: true
|
||||
exit: true,
|
||||
retries: 4
|
||||
};
|
||||
|
||||
if (process.env.CI) {
|
||||
console.log("Running tests in parallel");
|
||||
config.parallel = true;
|
||||
config.jobs = 6;
|
||||
console.log("Activating allure reporting");
|
||||
config.reporter = 'mocha-multi-reporters';
|
||||
console.log("Using JSON reporter for test results");
|
||||
config.reporter = 'json';
|
||||
config.reporterOptions = {
|
||||
configFile: '.mocha.reporters.json'
|
||||
output: 'reports/mocha-results.json'
|
||||
};
|
||||
} else {
|
||||
console.log("Running tests serially. To enable parallel execution update mocha config");
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"reporterEnabled": "spec, allure-mocha",
|
||||
"allureMochaReporter": {
|
||||
"outputDir": "allure-results"
|
||||
}
|
||||
}
|
@ -14,10 +14,10 @@ if (process.env.CI) {
|
||||
console.log("Running tests in parallel");
|
||||
config.parallel = true;
|
||||
config.jobs = 6;
|
||||
console.log("Activating allure reporting");
|
||||
config.reporter = 'mocha-multi-reporters';
|
||||
console.log("Using JSON reporter for test results");
|
||||
config.reporter = 'json';
|
||||
config.reporterOptions = {
|
||||
configFile: '.mocha.reporters.json'
|
||||
output: 'reports/mocha-results.json'
|
||||
};
|
||||
} else {
|
||||
console.log("Running tests serially. To enable parallel execution update mocha config");
|
||||
|
@ -42,8 +42,8 @@
|
||||
"check:spelling": "cspell \"{README.md,{tests,src}/**/*.ts}\"",
|
||||
"check:tsc": "tsc -p tsconfig.dev.json",
|
||||
"test": "NODE_ENV=test run-s test:*",
|
||||
"test:node": "NODE_ENV=test node ./src/run-tests.js \"tests/**/!(*.optional).spec.ts\"",
|
||||
"test:optional": "NODE_ENV=test node ./src/run-tests.js \"tests/**/@(*.optional).spec.ts\"",
|
||||
"test:node": "NODE_ENV=test mkdir -p reports && node ./src/run-tests.js \"tests/**/!(*.optional).spec.ts\"",
|
||||
"test:optional": "NODE_ENV=test mkdir -p reports && node ./src/run-tests.js \"tests/**/@(*.optional).spec.ts\"",
|
||||
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
|
||||
},
|
||||
"engines": {
|
||||
@ -79,8 +79,6 @@
|
||||
"@waku/message-encryption": "*",
|
||||
"@waku/relay": "*",
|
||||
"@waku/sdk": "*",
|
||||
"allure-commandline": "^2.27.0",
|
||||
"allure-mocha": "^2.9.2",
|
||||
"chai": "^4.3.10",
|
||||
"cspell": "^8.6.1",
|
||||
"datastore-core": "^10.0.2",
|
||||
@ -88,7 +86,6 @@
|
||||
"interface-datastore": "^8.2.10",
|
||||
"libp2p": "2.1.8",
|
||||
"mocha": "^10.3.0",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"npm-run-all": "^4.1.5"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { exec, spawn } from "child_process";
|
||||
import { mkdir } from "fs/promises";
|
||||
import { dirname } from "path";
|
||||
import { promisify } from "util";
|
||||
|
||||
const execAsync = promisify(exec);
|
||||
@ -20,10 +22,34 @@ async function main() {
|
||||
"--require",
|
||||
"ts-node/register",
|
||||
"--project",
|
||||
"./tsconfig.dev.json",
|
||||
...process.argv.slice(2)
|
||||
"./tsconfig.dev.json"
|
||||
];
|
||||
|
||||
if (process.env.CI) {
|
||||
const reportPath = "reports/mocha-results.json";
|
||||
await mkdir(dirname(reportPath), { recursive: true });
|
||||
|
||||
mochaArgs.push(
|
||||
"--reporter",
|
||||
"json",
|
||||
"--reporter-option",
|
||||
`output=${reportPath}`,
|
||||
"--parallel",
|
||||
"--jobs",
|
||||
"6"
|
||||
);
|
||||
}
|
||||
|
||||
// Add test files
|
||||
const testFiles = process.argv.slice(2);
|
||||
if (testFiles.length === 0) {
|
||||
// Default to all test files if none specified
|
||||
testFiles.push("tests/**/*.spec.ts");
|
||||
}
|
||||
mochaArgs.push(...testFiles);
|
||||
|
||||
console.log("Running mocha with args:", mochaArgs);
|
||||
|
||||
// Run mocha tests
|
||||
const mocha = spawn("npx", mochaArgs, {
|
||||
stdio: "inherit",
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"reporterEnabled": "spec, allure-mocha",
|
||||
"allureMochaReporter": {
|
||||
"outputDir": "allure-results"
|
||||
}
|
||||
}
|
@ -7,17 +7,18 @@ const config = {
|
||||
'experimental-specifier-resolution=node',
|
||||
'loader=ts-node/esm'
|
||||
],
|
||||
exit: true
|
||||
exit: true,
|
||||
retries: 4
|
||||
};
|
||||
|
||||
if (process.env.CI) {
|
||||
console.log("Running tests in parallel");
|
||||
config.parallel = true;
|
||||
config.jobs = 6;
|
||||
console.log("Activating allure reporting");
|
||||
config.reporter = 'mocha-multi-reporters';
|
||||
console.log("Using JSON reporter for test results");
|
||||
config.reporter = 'json';
|
||||
config.reporterOptions = {
|
||||
configFile: '.mocha.reporters.json'
|
||||
output: 'reports/mocha-results.json'
|
||||
};
|
||||
} else {
|
||||
console.log("Running tests serially. To enable parallel execution update mocha config");
|
||||
|
Loading…
x
Reference in New Issue
Block a user