1- import { AllureReport , resolveConfig } from "@allurereport/core" ;
1+ import { AllureReport , enforcePlugin , readConfig } from "@allurereport/core" ;
2+ import { default as AwesomePlugin , type AwesomePluginOptions } from "@allurereport/plugin-awesome" ;
23import * as console from "node:console" ;
4+ import { realpath } from "node:fs/promises" ;
5+ import process from "node:process" ;
36import { createCommand } from "../utils/commands.js" ;
47
58type AwesomeCommandOptions = {
9+ cwd ?: string ;
10+ config ?: string ;
611 output ?: string ;
712 reportName ?: string ;
813 reportLanguage ?: string ;
@@ -14,22 +19,35 @@ type AwesomeCommandOptions = {
1419} ;
1520
1621export const AwesomeCommandAction = async ( resultsDir : string , options : AwesomeCommandOptions ) => {
22+ const cwd = await realpath ( options . cwd ?? process . cwd ( ) ) ;
1723 const before = new Date ( ) . getTime ( ) ;
18- const { output , reportName : name , historyPath , knownIssues : knownIssuesPath , groupBy , ... rest } = options ;
19- const config = await resolveConfig ( {
24+ const {
25+ config : configPath ,
2026 output,
21- name ,
27+ reportName ,
2228 historyPath,
23- knownIssuesPath,
24- plugins : {
25- "@allurereport/plugin-awesome" : {
26- options : {
27- ...rest ,
28- groupBy : groupBy ?. split ( "," ) ,
29- } ,
30- } ,
29+ knownIssues : knownIssuesPath ,
30+ groupBy,
31+ ...rest
32+ } = options ;
33+ const defaultAwesomeOptions = {
34+ ...rest ,
35+ groupBy : groupBy ?. split ( "," ) ,
36+ } as AwesomePluginOptions ;
37+ const config = enforcePlugin (
38+ await readConfig ( cwd , configPath , {
39+ output,
40+ name : reportName ,
41+ knownIssuesPath,
42+ historyPath,
43+ } ) ,
44+ {
45+ id : "awesome" ,
46+ enabled : true ,
47+ options : defaultAwesomeOptions ,
48+ plugin : new AwesomePlugin ( defaultAwesomeOptions ) ,
3149 } ,
32- } ) ;
50+ ) ;
3351 const allureReport = new AllureReport ( config ) ;
3452
3553 await allureReport . start ( ) ;
@@ -45,6 +63,18 @@ export const AwesomeCommand = createCommand({
4563 name : "awesome <resultsDir>" ,
4664 description : "Generates Allure Awesome report based on provided Allure Results" ,
4765 options : [
66+ [
67+ "--config, -c <file>" ,
68+ {
69+ description : "The path Allure config file" ,
70+ } ,
71+ ] ,
72+ [
73+ "--cwd <cwd>" ,
74+ {
75+ description : "The working directory for the command to run (Default: current working directory)" ,
76+ } ,
77+ ] ,
4878 [
4979 "--output, -o <file>" ,
5080 {
0 commit comments