Skip to content
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
63 changes: 51 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,63 @@ permissions:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
registry-url: https://registry.npmjs.org/
- run: npm ci
- name: "Fetch & Unpack Allure Commandline from Maven Central"
run: ./fetch-source.sh
- run: npm pack
- id: get_version
run: echo version=$(npm pkg get version) >> $GITHUB_OUTPUT
- run: mv allure-commandline-${{ fromJSON(steps.get_version.outputs.version) }}.tgz package.tgz
- name: Upload allure-commandline artifact
uses: actions/upload-artifact@v5
with:
name: allure-commandline
path: package.tgz
- name: Upload test data
uses: actions/upload-artifact@v5
with:
name: test-data
path: test-data


test:
needs: build
strategy:
fail-fast: false
matrix:
node-version: [ 18, 20, 21 ]
node-version: [ 18, 20, 22, 24 ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
results: [ 'directory with space', simple ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
- run: npm ci
- name: "Fetch & Unpack Allure Commandline from Maven Central"
run: ./fetch-source.sh
if: runner.os != 'Windows'
- name: "Fetch & Unpack Allure Commandline from Maven Central"
run: powershell -ExecutionPolicy Bypass -File fetch-source.ps1
if: runner.os == 'Windows'
- run: npm link
- run: allure --version
- uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-package: 'jre'
java-version: 8
- name: Download allure-commandline artifact
uses: actions/download-artifact@v6
with:
name: allure-commandline
- name: Download test-data artifact
uses: actions/download-artifact@v6
with:
name: test-data
- name: Print bundled allure-commandline version
run: npx --yes package.tgz --version
- name: Generate Allure Report
run: npx --yes package.tgz generate "${{ matrix.results }}"
- name: Fail the job if the report has no results
if: ${{ hashFiles('allure-report/data/test-cases/') == '' }}
run: exit 1
39 changes: 30 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
#!/usr/bin/env node
var path = require('path');
var isWindows = path.sep === '\\';
var allureCommand = 'allure' + (isWindows ? '.bat' : '');
var path = require("node:path");

module.exports = function(args) {
return require('child_process').spawn(path.join(__dirname, 'dist/bin', allureCommand), args, {
env: process.env,
stdio: 'inherit',
shell: true,
});
function escapeCMDArg(arg) {
if (/[\r\n]/.test(arg)) throw new Error("Invalid character in argument");
return `"${arg
.replace(/\\+(?="|$)/g, "$&$&")
Comment thread Dismissed
.replace(/"/g, '""')
.replace(/%/g, "%%cd:~,%")}"`;
}

module.exports = function (args) {
var process = require("node:process");
var childProcess = require("node:child_process");
if (process.platform === "win32") {
let command = path.join(__dirname, "dist/bin/allure.bat");
return childProcess.spawn(
"cmd.exe",
["/E:ON", "/F:OFF", "/V:OFF", "/d", "/s", "/c", `"${[command, ...args].map(escapeCMDArg).join(" ")}"`],
Comment thread Dismissed
{
env: process.env,
stdio: "inherit",
shell: false,
windowsVerbatimArguments: true,
},
);
}

return childProcess.spawn(path.join(__dirname, "dist/bin/allure"), args, {
env: process.env,
stdio: "inherit",
});
};
46 changes: 46 additions & 0 deletions test-data/directory with space/a-result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"uuid": "0a4e08bb-194c-45be-82fb-985ea654f202",
"name": "ssimple test",
"historyId": "__7e359adbba67eeb93ce9322100913ab2:__",
"status": "passed",
"statusDetails": {},
"stage": "finished",
"steps": [],
"attachments": [],
"parameters": [],
"labels": [
{
"name": "module",
"value": "core"
},
{
"name": "framework",
"value": "vitest"
},
{
"name": "language",
"value": "javascript"
},
{
"name": "parentSuite",
"value": "attachments"
},
{
"name": "host",
"value": "agent-1"
},
{
"name": "thread",
"value": "vitest-worker-1"
},
{
"name": "package",
"value": "test.store.store.test.ts"
}
],
"links": [],
"start": 1736958120045,
"fullName": "test/simple.test.ts#simple test",
"testCaseId": "__7e359adbba67eeb93ce9322100913ab2",
"stop": 1736958120045
}
46 changes: 46 additions & 0 deletions test-data/simple/a-result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"uuid": "0a4e08bb-194c-45be-82fb-985ea654f202",
"name": "ssimple test",
"historyId": "__7e359adbba67eeb93ce9322100913ab2:__",
"status": "passed",
"statusDetails": {},
"stage": "finished",
"steps": [],
"attachments": [],
"parameters": [],
"labels": [
{
"name": "module",
"value": "core"
},
{
"name": "framework",
"value": "vitest"
},
{
"name": "language",
"value": "javascript"
},
{
"name": "parentSuite",
"value": "attachments"
},
{
"name": "host",
"value": "agent-1"
},
{
"name": "thread",
"value": "vitest-worker-1"
},
{
"name": "package",
"value": "test.store.store.test.ts"
}
],
"links": [],
"start": 1736958120045,
"fullName": "test/simple.test.ts#simple test",
"testCaseId": "__7e359adbba67eeb93ce9322100913ab2",
"stop": 1736958120045
}