Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mockyeah-cli

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mockyeah-cli - npm Package Compare versions

Comparing version 0.22.0-alpha.3 to 0.22.0

.DS_Store

2

.eslintrc.js

@@ -1,1 +0,1 @@

module.exports = require('tools/.eslintrc.js');
module.exports = require('mockyeah-tools/.eslintrc.js');

@@ -12,10 +12,15 @@ #!/usr/bin/env node

const program = require('commander');
const boot = require('../lib/boot');
const version = require('../version');
program
.version(version)
.command('ls', 'list service captures')
.command('play [name]', 'play service capture')
.command('playAll', 'play all service captures')
.command('record [name]', 'record service capture')
.parse(process.argv);
program.parse(process.argv);
boot(() => {
program
.version(version)
.command('ls', 'list suites')
.command('play [name]', 'play suite')
.command('playAll', 'play all suites')
.command('record [name]', 'record suite')
.parse(process.argv);
});

@@ -16,5 +16,5 @@ 'use strict';

boot(env => {
fs.readdirSync(env.config.capturesDir)
fs.readdirSync(env.config.suitesDir)
.sort()
.filter(file => console.log(` ${file}`));
});

@@ -37,16 +37,16 @@ 'use strict';

const { capturesDir } = env.config;
let captureNames;
const { suitesDir } = env.config;
let suiteNames;
try {
captureNames = fs
.readdirSync(capturesDir)
.filter(file => fs.statSync(path.join(capturesDir, file)).isDirectory());
suiteNames = fs
.readdirSync(suitesDir)
.filter(file => fs.statSync(path.join(suitesDir, file)).isDirectory());
} catch (err) {
console.log(chalk.red(`Capture directory not found at ${capturesDir}`));
console.log(chalk.red(`Suite directory not found at ${suitesDir}`));
process.exit(1);
}
if (!captureNames.length) {
console.log(chalk.red('No captures available to start'));
if (!suiteNames.length) {
console.log(chalk.red('No suites available to start'));
console.log(chalk.red('Record one by running: mockyeah record [name]'));

@@ -62,4 +62,4 @@ process.exit(0);

name: 'name',
message: 'Choose a recording to play:',
choices: captureNames
message: 'Choose a suite to play:',
choices: suiteNames
}

@@ -66,0 +66,0 @@ ],

@@ -21,9 +21,9 @@ 'use strict';

boot(env => {
const { capturesDir } = env.config;
const { suitesDir } = env.config;
try {
const stat = fs.statSync(capturesDir);
const stat = fs.statSync(suitesDir);
if (!stat.isDirectory()) throw new Error('Not a directory');
} catch (err) {
console.log(chalk.red(`Capture directory not found at ${capturesDir}`));
console.log(chalk.red(`Suite directory not found at ${suitesDir}`));
process.exit(1);

@@ -30,0 +30,0 @@ }

@@ -17,3 +17,3 @@ 'use strict';

// TODO: write tests for this
const collect = (val, memo) => {
const collectHeaders = (val, memo = {}) => {
const pair = val.split(/\s*:\s*/);

@@ -26,11 +26,23 @@ const key = pair[0];

const collectCommaSeparated = (val, memo = []) => [...memo, ...val.split(',').map(v => v.trim())];
const collect = (val, memo = []) => [...memo, val.trim()];
program
.option('-o, --only <regex>', 'only record calls to URLs matching given regex pattern')
.option(
'-g, --groups [name]',
'record with these named groups from configuration (comma-separated and/or repeatable)',
collectCommaSeparated
)
.option(
'-o, --only [regex]',
'only record calls to URLs matching given regex pattern (repeatable)',
collect
)
.option('-h, --use-headers', 'record headers to response options')
.option('-l, --use-latency', 'record latency to response options')
.option(
'-H, --header <line>',
'record matches will require these headers ("Name: Value")',
collect,
{}
'-H, --header [pair]',
'record matches will require these headers ("Name: Value") (repeatable)',
collectHeaders
)

@@ -90,3 +102,3 @@ .option('-v, --verbose', 'verbose output')

const [name] = program.args;
const { only, header, useHeaders, useLatency } = program;
const { groups, only, header, useHeaders, useLatency } = program;

@@ -96,2 +108,3 @@ env.program = program;

const options = {
groups,
only,

@@ -98,0 +111,0 @@ headers: header,

@@ -12,5 +12,3 @@ 'use strict';

configName: '.mockyeah',
extensions: {
'': null
},
extensions: {},
v8flags

@@ -17,0 +15,0 @@ });

{
"name": "mockyeah-cli",
"version": "0.22.0-alpha.3",
"version": "0.22.0",
"description": "A powerful service mocking, recording, and playback utility.",

@@ -65,3 +65,3 @@ "main": "index.js",

"devDependencies": {
"mockyeah": "^0.22.0-alpha.3"
"mockyeah": "^0.22.0"
},

@@ -71,3 +71,3 @@ "engines": {

},
"gitHead": "afa89300f247d617a4f2dd89be86193328238b14"
"gitHead": "b861712ba39c50866aacf384eec4808873382dc1"
}

@@ -1,1 +0,1 @@

module.exports = require('tools/prettier.config.js');
module.exports = require('mockyeah-tools/prettier.config.js');

@@ -6,3 +6,3 @@ # mockyeah-cli

<img src="docs/book/logo/mockyeah.png" height="200" />
<img src="../../packages/mockyeah-docs/book/logo/mockyeah.png" height="200" />

@@ -20,6 +20,6 @@ [![npm](https://img.shields.io/npm/v/mockyeah-cli.svg)](https://www.npmjs.com/package/mockyeah-cli)

ls list service captures
play [name] play service capture
playAll play all service captures
record [name] record service capture
ls list suites
play [name] play suite
playAll play all suites
record [name] record suite
help [cmd] display help for [cmd]

@@ -26,0 +26,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc