mirror of https://github.com/Seich/Beau.git
Compare commits
12 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
eee0aa95ea | |
|
|
b54d2158df | |
|
|
8b72a42af1 | |
|
|
ac432305b9 | |
|
|
98c6b4d941 | |
|
|
1027825091 | |
|
|
7e7ae395f9 | |
|
|
e0de623d1a | |
|
|
92485a5277 | |
|
|
3175e8c142 | |
|
|
2302763503 | |
|
|
fd2cc609ea |
|
|
@ -18,7 +18,7 @@ class Base extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
let config
|
let config
|
||||||
yaml.safeLoadAll(fs.readFileSync(configFile, 'utf-8'), (doc) => {
|
yaml.loadAll(fs.readFileSync(configFile, 'utf-8'), (doc) => {
|
||||||
const valid = validate(doc)
|
const valid = validate(doc)
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
const clc = require('cli-color')
|
const clc = require('cli-color')
|
||||||
const { Line } = require('clui')
|
const { Line } = require('clui')
|
||||||
|
const { expandPath } = require('../../../src/shared')
|
||||||
const Base = require('../base')
|
const Base = require('../base')
|
||||||
|
|
||||||
class ListCommand extends Base {
|
class ListCommand extends Base {
|
||||||
|
|
@ -31,9 +32,7 @@ class ListCommand extends Base {
|
||||||
.padding(2)
|
.padding(2)
|
||||||
.column(VERB, 20, [clc.yellow])
|
.column(VERB, 20, [clc.yellow])
|
||||||
.column(ALIAS, 30, [clc.yellow])
|
.column(ALIAS, 30, [clc.yellow])
|
||||||
.column(
|
.column(expandPath(ENDPOINT, PATH))
|
||||||
ENDPOINT.replace(/\/$/, '') + '/' + PATH.replace(/^\//, '')
|
|
||||||
)
|
|
||||||
.output()
|
.output()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class RequestCommand extends Base {
|
||||||
|
|
||||||
const { name } = await prompts({
|
const { name } = await prompts({
|
||||||
name: 'name',
|
name: 'name',
|
||||||
message: 'Pick as Request to execute',
|
message: 'Pick a Request to execute',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
choices: requests
|
choices: requests
|
||||||
})
|
})
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "beau",
|
"name": "beau",
|
||||||
"version": "0.11.2",
|
"version": "0.11.3",
|
||||||
"description": "Testing APIs made easy.",
|
"description": "Testing APIs made easy.",
|
||||||
"main": "./src/beau.js",
|
"main": "./src/beau.js",
|
||||||
"author": "David Díaz <seich@martianwabbit.com>",
|
"author": "David Díaz <seich@martianwabbit.com>",
|
||||||
|
|
@ -17,19 +17,19 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oclif/command": "1.8.0",
|
"@oclif/command": "1.8.0",
|
||||||
"@oclif/config": "1.17.0",
|
"@oclif/config": "1.17.0",
|
||||||
"@oclif/plugin-help": "3.2.0",
|
"@oclif/plugin-help": "3.2.1",
|
||||||
"@oclif/plugin-warn-if-update-available": "1.7.0",
|
"@oclif/plugin-warn-if-update-available": "1.7.0",
|
||||||
"ajv": "7.0.0-beta.6",
|
"ajv": "7.0.3",
|
||||||
"beau-std": "0.9.4",
|
"beau-std": "0.9.4",
|
||||||
"better-ajv-errors": "0.6.7",
|
"better-ajv-errors": "0.7.0",
|
||||||
"cli-color": "2.0.0",
|
"cli-color": "2.0.0",
|
||||||
"clui": "0.3.6",
|
"clui": "0.3.6",
|
||||||
"color-json": "2.0.1",
|
"color-json": "2.0.1",
|
||||||
"deepmerge": "4.2.2",
|
"deepmerge": "4.2.2",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"globby": "11.0.1",
|
"globby": "11.0.2",
|
||||||
"is-plain-object": "5.0.0",
|
"is-plain-object": "5.0.0",
|
||||||
"js-yaml": "3.14.0",
|
"js-yaml": "4.0.0",
|
||||||
"prompts": "2.4.0",
|
"prompts": "2.4.0",
|
||||||
"request": "2.88.2",
|
"request": "2.88.2",
|
||||||
"request-promise-native": "1.0.9",
|
"request-promise-native": "1.0.9",
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
"jest": "26.6.3",
|
"jest": "26.6.3",
|
||||||
"jest-watch-typeahead": "0.6.1",
|
"jest-watch-typeahead": "0.6.1",
|
||||||
"strip-ansi": "6.0.0",
|
"strip-ansi": "6.0.0",
|
||||||
"np": "7.0.0"
|
"np": "7.2.0"
|
||||||
},
|
},
|
||||||
"oclif": {
|
"oclif": {
|
||||||
"commands": "./bin/cli/commands",
|
"commands": "./bin/cli/commands",
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ describe(`Beau's config Loader.`, () => {
|
||||||
it('should load the config', () => {
|
it('should load the config', () => {
|
||||||
moduleVersion.mockReturnValue(1)
|
moduleVersion.mockReturnValue(1)
|
||||||
|
|
||||||
const doc = yaml.safeLoad(`
|
const doc = yaml.load(`
|
||||||
version: 1
|
version: 1
|
||||||
endpoint: 'http://example.com'
|
endpoint: 'http://example.com'
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ describe(`Beau's config Loader.`, () => {
|
||||||
it(`should load the request list using the configuration`, () => {
|
it(`should load the request list using the configuration`, () => {
|
||||||
moduleVersion.mockReturnValue(1)
|
moduleVersion.mockReturnValue(1)
|
||||||
|
|
||||||
const doc = yaml.safeLoad(`
|
const doc = yaml.load(`
|
||||||
version: 1
|
version: 1
|
||||||
endpoint: 'http://example.com'
|
endpoint: 'http://example.com'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ requireg.resolving = false
|
||||||
|
|
||||||
describe('Config', () => {
|
describe('Config', () => {
|
||||||
it('should load valid config keys', () => {
|
it('should load valid config keys', () => {
|
||||||
const doc = yaml.safeLoad(`
|
const doc = yaml.load(`
|
||||||
version: 1
|
version: 1
|
||||||
endpoint: http://martianwabbit.com
|
endpoint: http://martianwabbit.com
|
||||||
shouldntBeAdded: true
|
shouldntBeAdded: true
|
||||||
|
|
@ -19,7 +19,7 @@ describe('Config', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should load requests', () => {
|
it('should load requests', () => {
|
||||||
const doc = yaml.safeLoad(`
|
const doc = yaml.load(`
|
||||||
endpoint: http://example.com
|
endpoint: http://example.com
|
||||||
|
|
||||||
GET /profile: get-profile
|
GET /profile: get-profile
|
||||||
|
|
@ -36,7 +36,7 @@ describe('Config', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should set up defaults for all requests', () => {
|
it('should set up defaults for all requests', () => {
|
||||||
const doc = yaml.safeLoad(`
|
const doc = yaml.load(`
|
||||||
version: 1
|
version: 1
|
||||||
endpoint: 'http://example.com'
|
endpoint: 'http://example.com'
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ describe('Config', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should load multiple hosts', () => {
|
it('should load multiple hosts', () => {
|
||||||
const doc = yaml.safeLoad(`
|
const doc = yaml.load(`
|
||||||
version: 1
|
version: 1
|
||||||
endpoint: http://example.org
|
endpoint: http://example.org
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ describe('Config', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should namespace all aliases within an host', () => {
|
it('should namespace all aliases within an host', () => {
|
||||||
const doc = yaml.safeLoad(`
|
const doc = yaml.load(`
|
||||||
hosts:
|
hosts:
|
||||||
- host: test1
|
- host: test1
|
||||||
endpoint: http://example.com
|
endpoint: http://example.com
|
||||||
|
|
@ -122,7 +122,7 @@ describe('Config', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it(`should throw if host doesn't have a host key`, () => {
|
it(`should throw if host doesn't have a host key`, () => {
|
||||||
const doc = yaml.safeLoad(`
|
const doc = yaml.load(`
|
||||||
hosts:
|
hosts:
|
||||||
- endpoint: http://example.com
|
- endpoint: http://example.com
|
||||||
GET /posts: posts
|
GET /posts: posts
|
||||||
|
|
@ -136,7 +136,7 @@ describe('Config', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it(`should merge host settings with global settings`, () => {
|
it(`should merge host settings with global settings`, () => {
|
||||||
const doc = yaml.safeLoad(`
|
const doc = yaml.load(`
|
||||||
defaults:
|
defaults:
|
||||||
headers:
|
headers:
|
||||||
hello: 1
|
hello: 1
|
||||||
|
|
@ -159,7 +159,7 @@ describe('Config', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it(`should allow different settings for the same request`, () => {
|
it(`should allow different settings for the same request`, () => {
|
||||||
const doc = yaml.safeLoad(`
|
const doc = yaml.load(`
|
||||||
host: https://example.com
|
host: https://example.com
|
||||||
GET /1:
|
GET /1:
|
||||||
- alias: req1
|
- alias: req1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue