Skip to content

Commit

Permalink
Merge 275716b into d7dfa28
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Oct 9, 2020
2 parents d7dfa28 + 275716b commit 2bcbb1f
Show file tree
Hide file tree
Showing 15 changed files with 96 additions and 54 deletions.
5 changes: 3 additions & 2 deletions .eslintignore
@@ -1,4 +1,5 @@
node_modules
**/node_modules
docs
examples

packages/**/test/**/*.ts
packages/**/{test,dist}/**/*.ts
37 changes: 22 additions & 15 deletions .eslintrc.js → .eslintrc
@@ -1,18 +1,20 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
project: "tsconfig.json"
{
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
env: {
node: true,
es6: true
"env": {
"node": true,
"es6": true
},
plugins: ["@typescript-eslint"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
rules: {
"rules": {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
Expand All @@ -29,5 +31,10 @@ module.exports = {
"no-empty": "off",
"prefer-const": "off",
"no-fallthrough": "off"
}
};
},
"ignorePatterns": [
"**/lib/**/*.ts",
"**/test/**/*.ts",
"**/node_modules/**/*.ts"
]
}
File renamed without changes.
2 changes: 1 addition & 1 deletion .lintstagedrc
@@ -1,7 +1,7 @@
{
"packages/*/src/**/*.ts": [
"prettier --write",
"yarn test:lint:fix",
"eslint --fix",
"git add"
]
}
9 changes: 6 additions & 3 deletions package.json
Expand Up @@ -9,8 +9,8 @@
"test": "yarn clean && yarn test:lint && yarn test:coverage",
"test:unit": "cross-env NODE_ENV=test mocha",
"test:coverage": "cross-env NODE_ENV=test nyc mocha",
"test:lint": "eslint . --ext .ts",
"test:lint:fix": "eslint . --ext .ts --fix",
"test:lint": "eslint packages --ext .ts",
"test:lint:fix": "eslint packages --ext .ts --fix",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"build": "monorepo build",
"sync:packages": "monorepo sync packages",
Expand Down Expand Up @@ -86,7 +86,7 @@
"method-override": "3.0.0"
},
"devDependencies": {
"@tsed/monorepo-utils": "^1.9.4",
"@tsed/monorepo-utils": "^1.9.5",
"@typedproject/ts-doc": "4.0.9",
"@types/chai": "4.2.12",
"@types/chai-as-promised": "7.1.3",
Expand Down Expand Up @@ -114,6 +114,9 @@
"coveralls": "3.1.0",
"cross-env": "7.0.2",
"eslint": "^7.10.0",
"eslint-config-prettier": "6.12.0",
"eslint-plugin-prettier": "3.1.4",
"eslint-plugin-mocha": "8.0.0",
"fs-extra": "9.0.1",
"husky": "4.2.5",
"lint-staged": "10.2.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/ajv/src/pipes/AjvValidationPipe.spec.ts
Expand Up @@ -58,7 +58,7 @@ describe("AjvValidationPipe", () => {

const error = await validate(value, ParamMetadata.get(Ctrl, "get", 0));

expect(error?.message).to.deep.equal("Bad request on parameter \"request.body\".\nValue should be object. Given value: []");
expect(error?.message).to.deep.equal('Bad request on parameter "request.body".\nValue should be object. Given value: []');
expect(error?.origin?.errors).to.deep.equal([
{
data: [],
Expand Down
Expand Up @@ -13,7 +13,7 @@ describe("ParseExpressionError", () => {
} as any,
{message: "message"}
);
expect(error.message).to.equal("Bad request on parameter \"request.name.expression\".\nmessage");
expect(error.message).to.equal('Bad request on parameter "request.name.expression".\nmessage');
expect(error.name).to.equal("PARAM_VALIDATION_ERROR");
expect(error.dataPath).to.equal("expression");
expect(error.requestType).to.equal("name");
Expand Down Expand Up @@ -80,7 +80,7 @@ describe("ParseExpressionError", () => {
]);

const error = ParamValidationError.from(metadata, origin);
expect(error.message).to.equal("Bad request on parameter \"request.name.expression\".\nIt should have 1 item");
expect(error.message).to.equal('Bad request on parameter "request.name.expression".\nIt should have 1 item');
expect(error.dataPath).to.equal("expression");
expect(error.requestType).to.equal("name");

Expand Down
Expand Up @@ -18,7 +18,7 @@ describe("PassportSerializerService", () => {

const result = await new Promise((resolve) => service.serialize(userInfo, (...args: any[]) => resolve(args)));

expect(result).to.deep.eq([null, "{\"id\":\"id\",\"email\":\"email@email.fr\"}"]);
expect(result).to.deep.eq([null, '{"id":"id","email":"email@email.fr"}']);
})
);

Expand Down Expand Up @@ -48,7 +48,7 @@ describe("PassportSerializerService", () => {
"should deserialize model",
PlatformTest.inject([PassportSerializerService], async (service: PassportSerializerService) => {
const result = await new Promise((resolve) =>
service.deserialize("{\"id\":\"id\",\"email\":\"email@email.fr\"}", (...args: any[]) => resolve(args))
service.deserialize('{"id":"id","email":"email@email.fr"}', (...args: any[]) => resolve(args))
);

expect(result).to.deep.eq([
Expand All @@ -72,7 +72,7 @@ describe("PassportSerializerService", () => {
});

const result = await new Promise((resolve) =>
service.deserialize("{\"id\":\"id\",\"email\":\"email@email.fr\"}", (...args: any[]) => resolve(args))
service.deserialize('{"id":"id","email":"email@email.fr"}', (...args: any[]) => resolve(args))
);

expect(result).to.deep.eq([error]);
Expand Down
8 changes: 1 addition & 7 deletions packages/platform-express/src/index.ts
@@ -1,10 +1,4 @@
import {
createExpressApplication,
createHttpServer,
createHttpsServer,
ExpressApplication,
PlatformTest
} from "@tsed/common";
import {createExpressApplication, createHttpServer, createHttpsServer, ExpressApplication, PlatformTest} from "@tsed/common";

import {PlatformExpress} from "./components/PlatformExpress";

Expand Down
4 changes: 2 additions & 2 deletions packages/platform-test-utils/src/tests/testAcceptMime.ts
Expand Up @@ -30,7 +30,7 @@ export function testAcceptMime(options: PlatformTestOptions) {
});
after(PlatformTest.reset);
describe("Scenario 1: POST /rest/accept-mime/scenario-1", () => {
it("should return a 200 response when Accept header match with @AcceptMime(\"application/json\")", async () => {
it('should return a 200 response when Accept header match with @AcceptMime("application/json")', async () => {
const response = await request
.post("/rest/accept-mime/scenario-1")
.set({
Expand All @@ -42,7 +42,7 @@ export function testAcceptMime(options: PlatformTestOptions) {
accept: "application/json"
});
});
it("should return a 406 response when Accept header doesn't match with @AcceptMime(\"application/json\")", async () => {
it('should return a 406 response when Accept header doesn\'t match with @AcceptMime("application/json")', async () => {
const response = await request
.post("/rest/accept-mime/scenario-1")
.set({
Expand Down
4 changes: 2 additions & 2 deletions packages/platform-test-utils/src/tests/testErrors.ts
Expand Up @@ -142,7 +142,7 @@ export function testErrors(options: PlatformTestOptions) {
const response: any = await request.post("/rest/errors/scenario-5").expect(400);

expect(response.text).to.deep.eq(
"Bad request on parameter \"request.body\".<br />CustomModel should have required property 'name'. Given value: \"undefined\""
'Bad request on parameter "request.body".<br />CustomModel should have required property \'name\'. Given value: "undefined"'
);
// expect(response.body).to.deep.eq({
// "name": "AJV_VALIDATION_ERROR",
Expand All @@ -163,7 +163,7 @@ export function testErrors(options: PlatformTestOptions) {
const response: any = await request.post(`/rest/errors/scenario-6`).send({}).expect(400);

expect(response.text).to.deep.eq(
"Bad request on parameter \"request.body\".<br />CustomPropModel should have required property 'role_item'. Given value: \"undefined\""
'Bad request on parameter "request.body".<br />CustomPropModel should have required property \'role_item\'. Given value: "undefined"'
);
});
}
2 changes: 1 addition & 1 deletion packages/platform-test-utils/src/tests/testQueryParams.ts
Expand Up @@ -136,7 +136,7 @@ export function testQueryParams(options: PlatformTestOptions) {
const response = await request.get(`${endpoint}?test=error`).expect(400);
// FIXME REMOVE THIS when @tsed/schema is out
expect(response.text).to.deep.equal(
"Bad request on parameter \"request.query.test\".<br />Cast error. Expression value is not a number."
'Bad request on parameter "request.query.test".<br />Cast error. Expression value is not a number.'
);
});
it("should return undefined when query is empty", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-test-utils/src/tests/testResponse.ts
Expand Up @@ -263,7 +263,7 @@ export function testResponse(options: PlatformTestOptions) {
it("should throw a badRequest when path params isn't set as number", async () => {
const response = await request.get("/rest/response/scenario9/kkk").expect(400);

expect(response.text).to.equal("Bad request on parameter \"request.path.id\".<br />Cast error. Expression value is not a number.");
expect(response.text).to.equal('Bad request on parameter "request.path.id".<br />Cast error. Expression value is not a number.');
});
});
});
Expand Down
4 changes: 1 addition & 3 deletions packages/swagger/test/swagger.integration.spec.ts
Expand Up @@ -176,9 +176,7 @@ describe("Swagger integration", () => {
}
}
],
produces: [
"text/plain"
],
produces: ["text/plain"],
responses: {
"200": {
description: "Success"
Expand Down
61 changes: 50 additions & 11 deletions yarn.lock
Expand Up @@ -2181,10 +2181,10 @@
dependencies:
tslib "1.11.0"

"@tsed/monorepo-utils@^1.9.4":
version "1.9.4"
resolved "https://registry.yarnpkg.com/@tsed/monorepo-utils/-/monorepo-utils-1.9.4.tgz#5a6087414db3209b263d80e8c63ae7f2e479cf5f"
integrity sha512-hEtAClzBo+Gpt8EPhMZQa1ZosyHyFUBznuHgjRHlAqDU8lp0V63QVvEvVTqLGQPHwWvN31zu2tPLP9DagN9e2A==
"@tsed/monorepo-utils@^1.9.5":
version "1.9.5"
resolved "https://registry.yarnpkg.com/@tsed/monorepo-utils/-/monorepo-utils-1.9.5.tgz#087331a5de28a37504f951d552da4832f4132fa1"
integrity sha512-g7RbRszoCIDYEb5dAJaHJUt5gMaxg3agKa/CkFVV33OnjN/n6guN9qztXL3y/wRiJCoskVjjCALA8ZJP688q4A==
dependencies:
axios "0.19.2"
chalk "3.0.0"
Expand All @@ -2198,7 +2198,7 @@
has-yarn "^2.1.0"
inquirer "7.1.0"
listr "0.14.3"
lodash "4.17.15"
lodash "4.17.19"
normalize-path "3.0.0"
read-package-json "2.1.1"
semver "7.3.2"
Expand Down Expand Up @@ -6813,6 +6813,28 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=

eslint-config-prettier@6.12.0:
version "6.12.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.12.0.tgz#9eb2bccff727db1c52104f0b49e87ea46605a0d2"
integrity sha512-9jWPlFlgNwRUYVoujvWTQ1aMO8o6648r+K7qU7K5Jmkbyqav1fuEZC0COYpGBxyiAJb65Ra9hrmFx19xRGwXWw==
dependencies:
get-stdin "^6.0.0"

eslint-plugin-mocha@8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-mocha/-/eslint-plugin-mocha-8.0.0.tgz#7ec5d228bcb3735301701dfbc3376320a1ca3791"
integrity sha512-n67etbWDz6NQM+HnTwZHyBwz/bLlYPOxUbw7bPuCyFujv7ZpaT/Vn6KTAbT02gf7nRljtYIjWcTxK/n8a57rQQ==
dependencies:
eslint-utils "^2.1.0"
ramda "^0.27.1"

eslint-plugin-prettier@3.1.4:
version "3.1.4"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2"
integrity sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==
dependencies:
prettier-linter-helpers "^1.0.0"

eslint-scope@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848"
Expand Down Expand Up @@ -7254,6 +7276,11 @@ fast-deep-equal@^3.1.1:
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==

fast-diff@^1.1.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==

fast-glob@^2.0.2, fast-glob@^2.2.6:
version "2.2.7"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d"
Expand Down Expand Up @@ -7806,6 +7833,11 @@ get-stdin@^4.0.1:
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe"
integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=

get-stdin@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b"
integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==

get-stream@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
Expand Down Expand Up @@ -10221,12 +10253,7 @@ lodash.without@~4.4.0:
resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac"
integrity sha1-PNRXSgC2e643OpS3SHcmQFB7eqw=

lodash@4.17.15:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==

lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1:
lodash@4.17.19, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1:
version "4.17.19"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
Expand Down Expand Up @@ -12803,6 +12830,13 @@ prepend-http@^2.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=

prettier-linter-helpers@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
dependencies:
fast-diff "^1.1.2"

prettier@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5"
Expand Down Expand Up @@ -13092,6 +13126,11 @@ qw@~1.0.1:
resolved "https://registry.yarnpkg.com/qw/-/qw-1.0.1.tgz#efbfdc740f9ad054304426acb183412cc8b996d4"
integrity sha1-77/cdA+a0FQwRCassYNBLMi5ltQ=

ramda@^0.27.1:
version "0.27.1"
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.1.tgz#66fc2df3ef873874ffc2da6aa8984658abacf5c9"
integrity sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==

random-bytes@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/random-bytes/-/random-bytes-1.0.0.tgz#4f68a1dc0ae58bd3fb95848c30324db75d64360b"
Expand Down

0 comments on commit 2bcbb1f

Please sign in to comment.