Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: recruit-tech/agreed
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.1.6
Choose a base ref
...
head repository: recruit-tech/agreed
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.1.7
Choose a head ref

Commits on Apr 6, 2020

  1. Copy the full SHA
    505cd31 View commit details

Commits on May 15, 2020

  1. Copy the full SHA
    fe96868 View commit details

Commits on May 18, 2020

  1. Copy the full SHA
    50f24ca View commit details

Commits on May 20, 2020

  1. Copy the full SHA
    6595e93 View commit details

Commits on May 21, 2020

  1. Copy the full SHA
    dc5c22f View commit details

Commits on May 23, 2020

  1. Copy the full SHA
    fbef2c9 View commit details

Commits on May 27, 2020

  1. Create nodejs.yml

    yosuke-furukawa authored May 27, 2020
    Copy the full SHA
    1c8a755 View commit details

Commits on May 28, 2020

  1. Update nodejs.yml

    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    ea927af View commit details
  2. fix: linter errors

    yosuke-furukawa committed May 28, 2020
    Copy the full SHA
    d885a3f View commit details
  3. Copy the full SHA
    9b61f66 View commit details
  4. Merge pull request #156 from recruit-tech/add_lint

    fix: linter errors
    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    bfacf16 View commit details
  5. Merge pull request #157 from recruit-tech/renovate/serialize-javascri…

    …pt-3.x
    
    Update dependency serialize-javascript to v3.1.0
    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    62d3e56 View commit details
  6. Merge pull request #148 from recruit-tech/renovate/eslint-7.x

    Update dependency eslint to v7
    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    a524be6 View commit details
  7. Update README.md

    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    a89992e View commit details
  8. Copy the full SHA
    4ae65a5 View commit details
  9. update test

    yosuke-furukawa committed May 28, 2020
    Copy the full SHA
    4f4289d View commit details
  10. Copy the full SHA
    523cf43 View commit details
  11. Merge pull request #67 from recruit-tech/renovate/path-to-regexp-6.x

    Update dependency path-to-regexp to v6
    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    f19b8db View commit details
  12. Merge pull request #149 from recruit-tech/renovate/typescript-3.x

    Update dependency typescript to v3.9.3
    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    4343fa0 View commit details
  13. Merge pull request #150 from recruit-tech/renovate/eslint-plugin-reac…

    …t-7.x
    
    Update dependency eslint-plugin-react to v7.20.0
    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    ac5cb81 View commit details
  14. Merge pull request #151 from recruit-tech/renovate/jest-25.x

    Update dependency @types/jest to v25.2.3
    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    0c824f4 View commit details
  15. Merge pull request #152 from recruit-tech/renovate/ts-jest-26.x

    Update dependency ts-jest to v26
    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    a4de020 View commit details
  16. Merge pull request #154 from recruit-tech/renovate/major-typescript-e…

    …slint-monorepo
    
    Update dependency @typescript-eslint/typescript-estree to v3
    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    3e8e8ee View commit details
  17. Copy the full SHA
    4644e4e View commit details
  18. Merge pull request #158 from recruit-tech/remove_power_assert

    fix remove powerassert to suppress audit
    yosuke-furukawa authored May 28, 2020
    Copy the full SHA
    b92d292 View commit details
  19. v5.1.7

    yosuke-furukawa committed May 28, 2020
    Copy the full SHA
    9b9db97 View commit details
Showing with 1,737 additions and 1,494 deletions.
  1. +30 −0 .github/workflows/nodejs.yml
  2. +1 −2 README.md
  3. +1 −1 lerna.json
  4. +1 −1 packages/cli/package-lock.json
  5. +5 −5 packages/cli/package.json
  6. +1 −1 packages/client/package-lock.json
  7. +3 −3 packages/client/package.json
  8. +1 −1 packages/core/lib/check/checker.js
  9. +2 −2 packages/core/lib/check/completion.js
  10. +1 −1 packages/core/lib/check/defaultRequest.js
  11. +2 −2 packages/core/lib/check/defaultResponse.js
  12. +1 −1 packages/core/lib/check/diff.js
  13. +2 −2 packages/core/lib/check/extract.js
  14. +1 −1 packages/core/lib/check/isContentJSON.js
  15. +1 −1 packages/core/lib/require_hook/hook.js
  16. +1 −1 packages/core/lib/require_hook/requireUncached.js
  17. +6 −6 packages/core/lib/require_hook/typescript.js
  18. +2 −2 packages/core/lib/template/bind.js
  19. +6 −6 packages/core/lib/template/format.js
  20. +3 −3 packages/core/lib/template/hasTemplate.js
  21. +1 −1 packages/core/lib/template/toRegexp.js
  22. +307 −155 packages/core/package-lock.json
  23. +7 −4 packages/core/package.json
  24. +91 −91 packages/core/test/agrees/agrees.js
  25. +19 −19 packages/core/test/agrees/notify.js
  26. +1 −1 packages/core/test/helper/espowerLoader.js
  27. +1 −1 packages/core/test/helper/server.js
  28. +1 −1 packages/core/test/helper/server.notify.js
  29. +27 −27 packages/core/test/lib/client.broken.js
  30. +32 −32 packages/core/test/lib/client.js
  31. +17 −17 packages/core/test/lib/middleware.js
  32. +11 −11 packages/core/test/lib/server.arrayreqs.js
  33. +5 −5 packages/core/test/lib/server.arraysWithNull.js
  34. +6 −6 packages/core/test/lib/server.bodyHasNull.js
  35. +8 −8 packages/core/test/lib/server.checkHeadersCaseInsensitive.js
  36. +24 −24 packages/core/test/lib/server.customFuncs.js
  37. +65 −65 packages/core/test/lib/server.js
  38. +6 −6 packages/core/test/lib/server.messages.js
  39. +10 −10 packages/core/test/lib/server.nestedbind.js
  40. +12 −12 packages/core/test/lib/server.notify.js
  41. +4 −4 packages/core/test/lib/server.parseInt.js
  42. +5 −5 packages/core/test/lib/server.path.js
  43. +88 −88 packages/core/test/lib/server.pathParam.js
  44. +4 −4 packages/core/test/lib/server.randomInt.js
  45. +4 −4 packages/core/test/lib/server.randomString.js
  46. +9 −9 packages/core/test/lib/server.statusTemplate.js
  47. +46 −46 packages/core/test/lib/server.strict.js
  48. +18 −18 packages/core/test/lib/server.typedcachepath.js
  49. +4 −4 packages/core/test/lib/server.unixtime.js
  50. +1 −1 packages/server/package-lock.json
  51. +2 −2 packages/server/package.json
  52. +145 −438 packages/typed/package-lock.json
  53. +7 −9 packages/typed/package.json
  54. +9 −9 packages/typed/src/__tests__/server.ts
  55. +2 −2 packages/typed/src/bin/agreed-typed.ts
  56. +20 −20 packages/typed/src/commands/gen-swagger.ts
  57. +632 −278 packages/ui/package-lock.json
  58. +5 −5 packages/ui/package.json
  59. +1 −1 packages/ui/src/components/Agrees/index.js
  60. +5 −5 packages/ui/src/components/App/index.js
  61. +1 −1 packages/ui/src/components/JsonSchemaViewer/index.js
  62. +3 −3 packages/ui/src/components/Navigation/index.js
30 changes: 30 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install --no-save
- run: npx lerna bootstrap
- run: npx lerna run lint
- run: npm test
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# <img src="https://recruit-tech.github.io/agreed/media/logo-with-text.svg" width="300" />

[![Build Status](https://travis-ci.org/recruit-tech/agreed.svg?branch=master)](https://travis-ci.org/recruit-tech/agreed)

![Node.js CI](https://github.com/recruit-tech/agreed/workflows/Node.js%20CI/badge.svg)

agreed is Consumer Driven Contract tool with JSON mock server.

2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "5.1.6"
"version": "5.1.7"
}
2 changes: 1 addition & 1 deletion packages/cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agreed/cli",
"version": "5.1.6",
"version": "5.1.7",
"description": "Agreed is a tool for Consumer Driven Contract with JSON mock server",
"main": "index.js",
"bin": {
@@ -31,10 +31,10 @@
"plz-port": "1.0.0"
},
"dependencies": {
"@agreed/client": "^5.1.6",
"@agreed/server": "^5.1.6",
"@agreed/typed": "^5.1.6",
"@agreed/ui": "^5.1.6",
"@agreed/client": "^5.1.7",
"@agreed/server": "^5.1.7",
"@agreed/typed": "^5.1.7",
"@agreed/ui": "^5.1.7",
"colo": "^1.0.0",
"json5": "^2.0.0",
"minimist": "^1.2.0"
2 changes: 1 addition & 1 deletion packages/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agreed/client",
"version": "5.1.6",
"version": "5.1.7",
"description": "agreed client, testing utilities",
"main": "index.js",
"bin": "bin/agreed-client.js",
@@ -20,12 +20,12 @@
"author": "yosuke-furukawa",
"license": "MIT",
"dependencies": {
"@agreed/core": "^5.1.6",
"@agreed/core": "^5.1.7",
"colo": "^1.0.0",
"is-empty": "^1.0.0"
},
"devDependencies": {
"@agreed/server": "^5.1.6",
"@agreed/server": "^5.1.7",
"eater": "4.0.3",
"plz-port": "1.0.0"
},
2 changes: 1 addition & 1 deletion packages/core/lib/check/checker.js
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ class Checker {
let valuesSimilarity = 1;
if (pathToRegexpKeys.length !== 0) {
let matched = 0;
Object.keys(paths).forEach(k => {
Object.keys(paths).forEach((k) => {
if (paths[k] === values[k] + "") {
matched++;
}
4 changes: 2 additions & 2 deletions packages/core/lib/check/completion.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const pathToRegexp = require("path-to-regexp");
const { pathToRegexp } = require("path-to-regexp");
const path = require("path");
const requireAgree = require("../require_hook/requireAgree");

@@ -130,7 +130,7 @@ function toLowerCaseKeys(obj) {
const keys = Object.keys(obj);
const result = {};

keys.forEach(key => {
keys.forEach((key) => {
result[key.toLowerCase()] = obj[key];
});
return result;
2 changes: 1 addition & 1 deletion packages/core/lib/check/defaultRequest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
method: "GET",
body: "",
headers: {}
headers: {},
};
4 changes: 2 additions & 2 deletions packages/core/lib/check/defaultResponse.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
status: 200,
headers: {
"Content-Type": "application/json; charset=utf-8"
"Content-Type": "application/json; charset=utf-8",
},
body: ""
body: "",
};
2 changes: 1 addition & 1 deletion packages/core/lib/check/diff.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
const {
hasTemplate,
hasTemplateWithAnyString,
isRestArrayTemplate
isRestArrayTemplate,
} = require("../template/hasTemplate");
const toRegexp = require("../template/toRegexp");

4 changes: 2 additions & 2 deletions packages/core/lib/check/extract.js
Original file line number Diff line number Diff line change
@@ -2,10 +2,10 @@

const url = require("url");
const qs = require("querystring");
const pathToRegexp = require("path-to-regexp");
const { pathToRegexp } = require("path-to-regexp");
const format = require("../template/format");

module.exports.incomingRequest = req => {
module.exports.incomingRequest = (req) => {
return new Promise((resolve, reject) => {
const result = {};

2 changes: 1 addition & 1 deletion packages/core/lib/check/isContentJSON.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

module.exports = obj => {
module.exports = (obj) => {
const isContentJSON =
obj.headers &&
obj.headers["Content-Type"] &&
2 changes: 1 addition & 1 deletion packages/core/lib/require_hook/hook.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ const fs = require("fs");
const compile = require("./compile");

module.exports = (parse, extensions) => {
extensions.forEach(ext => {
extensions.forEach((ext) => {
delete require.extensions[ext];
require.extensions[ext] = (module, file) => {
const agree = parse(fs.readFileSync(file).toString("utf-8"));
2 changes: 1 addition & 1 deletion packages/core/lib/require_hook/requireUncached.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = module => {
module.exports = (module) => {
delete require.cache[require.resolve(module)];
return require(module);
};
12 changes: 6 additions & 6 deletions packages/core/lib/require_hook/typescript.js
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ const transpile = (src, options = {}) => {
const res = ts.transpileModule(
src,
options || {
compilerOptions: { module: ts.ModuleKind.CommonJS }
compilerOptions: { module: ts.ModuleKind.CommonJS },
}
).outputText;
return res;
@@ -22,10 +22,10 @@ const takeCache = (options) => {
return cache;
}
return {};
} catch(e) {
} catch (e) {
return {};
}
}
};

const getCacheAgree = (file, cache, mtimeMs) => {
if (cache && cache[file]) {
@@ -34,7 +34,7 @@ const getCacheAgree = (file, cache, mtimeMs) => {
}
}
return {};
}
};

const writeCacheOnExit = (options) => {
if (options.typedCachePath) {
@@ -47,7 +47,7 @@ const writeCacheOnExit = (options) => {
}
});
}
}
};

module.exports = (options, hot) => {
cache = takeCache(options);
@@ -73,7 +73,7 @@ module.exports = (options, hot) => {
agree,
};
}
// TODO: need to embed cache hit or not
// TODO: need to embed cache hit or not
module._compile(agree, file);
if (hot) {
fs.watch(file, () => {
4 changes: 2 additions & 2 deletions packages/core/lib/template/bind.js
Original file line number Diff line number Diff line change
@@ -6,15 +6,15 @@ module.exports = function bind(hasFormatObj, hasValueObj, result, original) {
if (!result) result = {};
if (!original) original = hasValueObj;
if (typeof hasFormatObj === "object") {
Object.keys(hasFormatObj).forEach(key => {
Object.keys(hasFormatObj).forEach((key) => {
if (hasTemplate(hasFormatObj[key])) {
const formatName = hasFormatObj[key].replace(
constants.TEMPLATE_REGEXP,
"$2"
);
const formatParts = formatName.split(".");
if (formatParts.length > 1) {
formatParts.forEach(part => {
formatParts.forEach((part) => {
if (hasValueObj[part]) {
result[part] = hasValueObj[part];
} else if (original[part]) {
12 changes: 6 additions & 6 deletions packages/core/lib/template/format.js
Original file line number Diff line number Diff line change
@@ -28,15 +28,15 @@ function format(template, args, funcs = {}) {

if (!matches) return result;

matches.forEach(match => {
matches.forEach((match) => {
var rawKey = match.replace(constants.TEMPLATE_REGEXP, "$2");

// brackets notation like '{:array[:index]}'
if (rawKey.indexOf("[:") >= 0) {
const matches = rawKey.match(constants.TEMPLATE_BRACKETS_REGEXP_GLOBAL);

matches &&
matches.forEach(match => {
matches.forEach((match) => {
const key = match.replace(constants.TEMPLATE_BRACKETS_REGEXP, "$1");
const value = "." + key.split(".").reduce((o, i) => o && o[i], args);

@@ -46,7 +46,7 @@ function format(template, args, funcs = {}) {
});
}

var value = rawKey.split(",").map(key => {
var value = rawKey.split(",").map((key) => {
if (key && args[key]) {
return args[key];
}
@@ -98,7 +98,7 @@ function formatObject(obj, args, funcs) {
return obj;
}

Object.keys(obj).forEach(key => {
Object.keys(obj).forEach((key) => {
const value = obj[key];
result[key] = format(value, args, funcs);
});
@@ -111,10 +111,10 @@ function formatArray(array, args, funcs) {
return array;
}

array.forEach(item => {
array.forEach((item) => {
const formattedItem = format(item, args, funcs);
if (formattedItem.__spread) {
formattedItem.forEach(item => {
formattedItem.forEach((item) => {
result.push(item);
});
} else {
6 changes: 3 additions & 3 deletions packages/core/lib/template/hasTemplate.js
Original file line number Diff line number Diff line change
@@ -2,19 +2,19 @@

const constants = require("./constants");

module.exports.hasTemplate = str => {
module.exports.hasTemplate = (str) => {
return typeof str === "string" && str.match(constants.TEMPLATE_REGEXP_GLOBAL);
};

module.exports.hasTemplateWithAnyString = str => {
module.exports.hasTemplateWithAnyString = (str) => {
if (typeof str !== "string") {
return false;
}
const removed = str.replace(constants.TEMPLATE_REGEXP_GLOBAL, "");
return removed.length > 0;
};

module.exports.isRestArrayTemplate = str => {
module.exports.isRestArrayTemplate = (str) => {
return (
typeof str === "string" &&
str.match(constants.TEMPLATE_REST_ARRAY_STRING_GLOBAL)
2 changes: 1 addition & 1 deletion packages/core/lib/template/toRegexp.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

const constants = require("./constants");

module.exports = str => {
module.exports = (str) => {
var rawString = str.replace(constants.TEMPLATE_REGEXP_GLOBAL, ".*");
rawString = "^" + rawString + "$";
return new RegExp(rawString);
Loading