Skip to content

Commit

Permalink
feat: remove report command (#3431)
Browse files Browse the repository at this point in the history
  • Loading branch information
hassy authored Dec 10, 2024
1 parent 45b9b52 commit 4a6a5aa
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 959 deletions.
3 changes: 0 additions & 3 deletions examples/cicd/aws-codebuild/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ phases:
build:
commands:
- artillery run --output reports/report.json tests/performance/socket-io.yml
post_build:
commands:
- artillery report --output reports/report.html reports/report.json

artifacts:
files:
Expand Down
3 changes: 0 additions & 3 deletions examples/cicd/azure-devops/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ steps:
- script: artillery run --output reports/report.json tests/performance/socket-io.yml
displayName: 'Execute load tests'

- script: artillery report --output reports/report.html reports/report.json
displayName: 'Generate HTML report'

- publish: $(System.DefaultWorkingDirectory)/reports
artifact: artillery-test-report
4 changes: 0 additions & 4 deletions examples/cicd/circleci/.circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ jobs:
name: Execute load tests
command: /home/node/artillery/bin/artillery run --output reports/report.json tests/performance/socket-io.yml

- run:
name: Generate HTML report
command: /home/node/artillery/bin/artillery report --output reports/report.html reports/report.json

- store_artifacts:
path: reports

Expand Down
1 change: 0 additions & 1 deletion examples/cicd/gitlab-ci-cd/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ artillery:
script: |
mkdir reports
/home/node/artillery/bin/artillery run --output reports/report.json tests/performance/socket-io.yml
/home/node/artillery/bin/artillery report --output reports/report.html reports/report.json
artifacts:
paths:
- reports
1 change: 0 additions & 1 deletion examples/cicd/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pipeline {
steps {
sh 'mkdir reports'
sh '/home/node/artillery/bin/artillery run --output reports/report.json tests/performance/socket-io.yml'
sh '/home/node/artillery/bin/artillery report --output reports/report.html reports/report.json'
}
}
}
Expand Down
53 changes: 8 additions & 45 deletions packages/artillery/lib/cmds/report.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
const { Command, Flags, Args } = require('@oclif/core');

const fs = require('fs');
const path = require('path');
const _ = require('lodash');
const telemetry = require('../telemetry').init();
const chalk = require('chalk');

class ReportCommand extends Command {
async run() {
console.error(deprecationNotice);
telemetry.capture('report generate');
const { flags, args } = await this.parse(ReportCommand);
const output = flags.output || args.file + '.html'; // TODO: path.resolve
const data = JSON.parse(fs.readFileSync(args.file, 'utf-8'));
data.intermediate.forEach((o) => delete o.latencies); // TODO: still needed?
data.name = args.file.match(/([^\/]*)$/)[0];
const templateFn = path.join(
path.dirname(__filename),
'../report/index.html.ejs'
);
const template = fs.readFileSync(templateFn, 'utf-8');
const compiledTemplate = _.template(template);
const html = compiledTemplate({ report: JSON.stringify(data, null, 2) });
fs.writeFileSync(output, html, { encoding: 'utf-8', flag: 'w' });
console.log('Report generated: %s', output);
}
}

Expand All @@ -38,33 +19,15 @@ ReportCommand.flags = {
};

const deprecationNotice = `
${chalk.blue(`┌───────────────────────────────────────────────────────────────────────┐
│`)} ${chalk.yellow(
'DEPRECATION NOTICE'
)} ${chalk.blue(`│
├───────────────────────────────────────────────────────────────────────┤
│`)} ${chalk.yellow(
'The "report" command is deprecated and will be removed in a future'
)} ${chalk.blue(`│
│`)} ${chalk.yellow(
'release of Artillery.'
)} ${chalk.blue(`│
│ │
│`)} ${chalk.blueBright('Artillery Cloud')} ${chalk.white(
'is now the recommended way to visualize test results.'
)} ${chalk.blue(`│
│`)} ${chalk.white(
'It provides more comprehensive reporting, advanced visualizations,'
)} ${chalk.blue(`│
│`)} ${chalk.white(
'and includes a free tier.'
)} ${chalk.blue(`│
│ │
│`)} ${chalk.white('Sign up on')} ${chalk.cyan(
chalk.underline('https://app.artillery.io')
)} ${chalk.blue(`│
┌───────────────────────────────────────────────────────────────────────┐
| ${chalk.blue(
'The "report" command has been deprecated and is no longer supported'
)} |
| |
| You can use Artillery Cloud (https://app.artillery.io) to visualize |
| test results, create custom reports, and share them with your team. |
└───────────────────────────────────────────────────────────────────────┘
`)}`;
`;

ReportCommand.args = { file: Args.string() };

Expand Down
Loading

0 comments on commit 4a6a5aa

Please sign in to comment.