Skip to content

Commit

Permalink
feat: remove the built-in report command
Browse files Browse the repository at this point in the history
  • Loading branch information
hassy committed Dec 10, 2024
1 parent 45b9b52 commit ec8405f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 947 deletions.
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 ec8405f

Please sign in to comment.