hping 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cli.js CHANGED
@@ -658,7 +658,8 @@ async function runCli(argv) {
658
658
  userConfigPath: userConfigPath(homeDir)
659
659
  };
660
660
  const program = buildProgram(context);
661
- await program.parseAsync(argv, { from: 'user' });
661
+ const normalizedArgv = argv.map((arg) => (arg === '-v' ? '-V' : arg));
662
+ await program.parseAsync(normalizedArgv, { from: 'user' });
662
663
  }
663
664
 
664
665
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hping",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "HTTP ping CLI with Node.js that sends HEAD or GET or POST requests to web or api servers and checks if they alive",
5
5
  "main": "lib/cli.js",
6
6
  "repository": {
@@ -274,6 +274,24 @@ test('no args prints help output', async () => {
274
274
  assert.match(result.stdout, /Examples:/);
275
275
  });
276
276
 
277
+ test('-V prints version and exits', async () => {
278
+ const result = await runCli(['-V'], {});
279
+ assert.equal(result.code, 0, result.stderr);
280
+ assert.match(result.stdout, /^\d+\.\d+\.\d+\n$/);
281
+ });
282
+
283
+ test('-v prints version and exits', async () => {
284
+ const result = await runCli(['-v'], {});
285
+ assert.equal(result.code, 0, result.stderr);
286
+ assert.match(result.stdout, /^\d+\.\d+\.\d+\n$/);
287
+ });
288
+
289
+ test('--version prints version and exits', async () => {
290
+ const result = await runCli(['--version'], {});
291
+ assert.equal(result.code, 0, result.stderr);
292
+ assert.match(result.stdout, /^\d+\.\d+\.\d+\n$/);
293
+ });
294
+
277
295
  test('missing custom config falls back to user config', async () => {
278
296
  const { home } = await makeTempHome();
279
297
  const missingConfig = path.resolve(home, 'missing-config.yaml');