New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

qontract

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qontract - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

2

package.json
{
"name": "qontract",
"version": "0.2.0",
"version": "0.3.0",
"description": "npm wrapper for qontract",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -8,4 +8,2 @@ [Qontract](https://qontract.run/) is a contract driven development tool that allows us to turn our contracts into executable specification.

`qontract-stub`
In stub mode, Qontract provides random responses to requests that match the contract. It’s a way of exploring what the contract looks like.

@@ -17,8 +15,6 @@ This is meant to be used by anyone who wants to take a fake version of the API for a spin.

`"qontract-stub": "./node_modules/.bin/qontract-stub --contractPath=*.qontract --host='localhost' --port='8000'"`
`"qontract-stub": "./node_modules/.bin/qontract-stub --contract-dir=*.qontract --stub-dir='path-to-stub-dir' --host='localhost' --port='8000'"`
## Qontract tests (For Providers)
`qontract-test`
In test mode, Qontracts accepts a contract file, and the hostname and port of the service whose API is being tested. It then sends an HTTP request based on the request format described in the contract for every scenario, generating random values where no examples are given. When the service responds, it validates the response based on the format in the contract.

@@ -29,5 +25,4 @@ This is meant to be used by API providers.

`"qontract-tests": "./node_modules/.bin/qontract-test --contractPath=*.qontract"`
`"qontract-tests": "./node_modules/.bin/qontract-test --contract-dir=*.qontract"`
## API

@@ -43,4 +38,6 @@

`contractPath` path of the contract files. Can be aa wild card string.
`contract-dir` path of the contract files. Can be a wild card string.
`stub-dir` path of the mock json files.
`host` hostname to be stubbed out. Used in stub mode only.

@@ -50,3 +47,3 @@

Check [Documentation](https://qontract.run/documentation.html) for more information
Check [Documentation](https://qontract.run/documentation.html) for more information.

@@ -6,11 +6,11 @@ #!/usr/bin/env node

const path = require('path');
const { qontractPath } = require('../config');
const jarPath = path.resolve(qontractPath);
const { qontractJarPathLocal } = require('../config');
const qontractJarPath = path.resolve(qontractJarPathLocal);
const {argv} = require('yargs')
const contractPath = path.resolve(argv.contractPath);
const {argv} = require('yargs');
const contractPath = path.resolve(argv['contract-dir']);
console.log('running qontract tests')
execSh(
`java -jar ${jarPath} test ${contractPath}`,
`java -jar ${qontractJarPath} test ${contractPath}`,
{ },

@@ -17,0 +17,0 @@ err => {

@@ -6,12 +6,13 @@ #!/usr/bin/env node

const path = require('path');
const { qontractPath } = require('../config');
const jarPath = path.resolve(qontractPath);
const { qontractJarPathLocal } = require('../config');
const qontractJarPath = path.resolve(qontractJarPathLocal);
const {argv} = require('yargs');
const { contractPath, host, port} = argv;
const contracts = path.resolve(contractPath);
const { 'contract-dir': contractDir, 'stub-dir': stubDir, host, port} = argv;
const contracts = path.resolve(contractDir);
const stubs = path.resolve(stubDir);
console.log('starting qontract stub server')
execSh(
`java -jar ${jarPath} stub ${contracts} --host=${host} --port=${port}`,
`java -jar ${qontractJarPath} stub ${contracts} --data ${stubs} --host=${host} --port=${port}`,
{ },

@@ -18,0 +19,0 @@ err => {

const config = {
qontractPath: './node_modules/qontract/qontract.jar',
qontractJarRemotePath: 'https://github.com/qontract/qontract/releases/download/0.13.1/qontract.jar'
qontractJarPathLocal: './node_modules/qontract/qontract.jar',
qontractJarPathRemote: 'https://github.com/qontract/qontract/releases/download/0.13.1/qontract.jar'
};
module.exports = config;
const init = async () => {
const download = require('download');
const { qontractJarRemotePath } = require('./config');
const { qontractJarPathRemote } = require('./config');
console .log('Starting qontract jar download..')
console.log('Starting qontract jar download..')
await (async () => {
await download(qontractJarRemotePath, '.');
await download(qontractJarPathRemote, '.');
})();
console .log('Finished qontract jar download!!')
console.log('Finished qontract jar download!!')
}
init();
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