Skip to content

Commit

Permalink
fix: bump typescript and update tsconfig options
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Jun 24, 2022
1 parent 057770b commit 44fd0ae
Show file tree
Hide file tree
Showing 59 changed files with 800 additions and 682 deletions.
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
test
src/**/*.js
src/**/*.js.map
__mock__
*.spec.js
coverage
tsconfig.json
tsconfig.compile.json
tslint.json
.travis.yml
.gitignore
.idea
packages
packages
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-workspaces": "0.7.0",
"fs-extra": "^10.0.1",
"husky": "^7.0.4",
"husky": "8.0.1",
"is-ci": "^3.0.1",
"jest": "27.5.1",
"jest": "28.1.1",
"lint-staged": "^12.3.2",
"micromatch": "4.0.5",
"mocha": "9.2.2",
Expand All @@ -151,11 +151,11 @@
"sinon": "13.0.1",
"sinon-chai": "3.7.0",
"supertest": "6.2.2",
"ts-jest": "27.1.4",
"ts-node": "10.7.0",
"tsconfig-paths": "3.14.1",
"ts-jest": "28.0.5",
"ts-node": "10.8.1",
"tsconfig-paths": "4.0.0",
"tslib": "2.4.0",
"typescript": "4.6.3"
"typescript": "4.7.4"
},
"directories": {
"packages": "packages",
Expand Down
2 changes: 2 additions & 0 deletions packages/core/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 1 addition & 1 deletion packages/core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
global: {
statements: 97.95,
branches: 89.65,
functions: 96.04,
functions: 96.03,
lines: 98.17
}
}
Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/decorators/enumerable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ class Test2 extends Parent1 {
describe("Enumerable", () => {
it("should have some keys with Test1", () => {
expect(getEnumerableKeys(new Test1())).toEqual(["test", "name"]);
expect(Object.keys(new Test1())).toEqual(["test"]);
expect(Object.getOwnPropertyNames(new Test1())).toEqual(["test"]);
expect(Reflect.ownKeys(new Test2())).toEqual(["prop", "test", "_privateTest"]);
expect(Object.keys(new Test1())).toEqual(["test", "name"]);
expect(Object.getOwnPropertyNames(new Test1())).toEqual(["test", "name"]);
expect(Reflect.ownKeys(new Test2())).toEqual(["parentProp", "prop", "test", "name", "_privateTest"]);
});

it("should have some keys with Test2", () => {
expect(getEnumerableKeys(new Test2())).toEqual(["prop", "test", "first", "privateTest", "name", "parentProp"]);
expect(Object.keys(new Test2())).toEqual(["prop", "test", "_privateTest"]);
expect(Object.getOwnPropertyNames(new Test2())).toEqual(["prop", "test", "_privateTest"]);
expect(Reflect.ownKeys(new Test2())).toEqual(["prop", "test", "_privateTest"]);
expect(getEnumerableKeys(new Test2())).toEqual(["parentProp", "prop", "test", "name", "first", "privateTest"]);
expect(Object.keys(new Test2())).toEqual(["parentProp", "prop", "test", "name", "_privateTest"]);
expect(Object.getOwnPropertyNames(new Test2())).toEqual(["parentProp", "prop", "test", "name", "_privateTest"]);
expect(Reflect.ownKeys(new Test2())).toEqual(["parentProp", "prop", "test", "name", "_privateTest"]);
});
});
2 changes: 2 additions & 0 deletions packages/di/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
4 changes: 3 additions & 1 deletion packages/engines/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ src
test
tsconfig.compile.json
tsconfig.json
jest.config.js
jest.config.js
__mock__
*.spec.js
6 changes: 3 additions & 3 deletions packages/engines/.nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"json"
],
"check-coverage": true,
"statements": 96.39,
"branches": 74.41,
"functions": 96.33,
"statements": 96.38,
"branches": 75.14,
"functions": 96.27,
"lines": 96.32
}
2 changes: 2 additions & 0 deletions packages/graphql/apollo/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/graphql/graphql-legacy/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/graphql/typegraphql/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
1 change: 1 addition & 0 deletions packages/graphql/typegraphql/test/graphql-passport.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe("GraphQL", () => {
code: "INTERNAL_SERVER_ERROR",
exception: {
headers: {},
message: "Wrong credentials",
name: "UNAUTHORIZED",
status: 401,
type: "HTTP_EXCEPTION"
Expand Down
2 changes: 2 additions & 0 deletions packages/orm/adapters-redis/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/orm/adapters/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
11 changes: 6 additions & 5 deletions packages/orm/adapters/src/adapters/LowDbAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {cleanObject} from "@tsed/core";
import isMatch from "lodash/isMatch";
import low from "lowdb";
import {v4 as uuid} from "uuid";
Expand Down Expand Up @@ -56,7 +57,7 @@ export class LowDbAdapter<T extends AdapterModel> extends Adapter<T> {
}

public async updateOne(predicate: Partial<T & any>, payload: T, expiresAt?: Date): Promise<T | undefined> {
let index = this.collection.findIndex(predicate).value();
let index = this.collection.findIndex(cleanObject(predicate)).value();

if (index === -1) {
return;
Expand All @@ -77,7 +78,7 @@ export class LowDbAdapter<T extends AdapterModel> extends Adapter<T> {
}

async findOne(predicate: Partial<T & any>): Promise<T | undefined> {
const item = this.collection.find(predicate).value();
const item = this.collection.find(cleanObject(predicate)).value();

return this.deserialize(item);
}
Expand All @@ -88,13 +89,13 @@ export class LowDbAdapter<T extends AdapterModel> extends Adapter<T> {

public async findAll(predicate: Partial<T & any> = {}): Promise<T[]> {
return this.collection
.filter(predicate)
.filter(cleanObject(predicate))
.value()
.map((item) => this.deserialize(item));
}

public async deleteOne(predicate: Partial<T & any>): Promise<T | undefined> {
const item = this.collection.find(predicate).value();
const item = this.collection.find(cleanObject(predicate)).value();

if (item) {
this.collection.remove(({_id}) => _id === item._id).write();
Expand All @@ -112,7 +113,7 @@ export class LowDbAdapter<T extends AdapterModel> extends Adapter<T> {

await this.collection
.remove((item) => {
if (isMatch(item, predicate)) {
if (isMatch(item, cleanObject(predicate))) {
removedItems.push(this.deserialize(item));
return true;
}
Expand Down
24 changes: 22 additions & 2 deletions packages/orm/adapters/src/adapters/MemoryAdapter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import faker from "@faker-js/faker";
import {Adapter, Adapters, MemoryAdapter} from "@tsed/adapters";
import {PlatformTest} from "@tsed/common";
import {deserialize} from "@tsed/json-mapper";
import {Format, Name, Property} from "@tsed/schema";
import faker from "@faker-js/faker";
import {getSchema} from "@tsed/mongoose";
import {Format, getJsonSchema, Name, Property} from "@tsed/schema";

class BaseClient {
@Format("date-time")
Expand All @@ -28,6 +29,25 @@ describe("MemoryAdapter", () => {
adapter: MemoryAdapter
});
});
describe("getSchema", () => {
it("should", () => {
expect(getJsonSchema(Client)).toEqual({
properties: {
createdAt: {
format: "date-time",
type: "string"
},
id: {
type: "string"
},
name: {
type: "string"
}
},
type: "object"
});
});
});

describe("create()", () => {
it("should create a new instance", async () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/orm/mikro-orm/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/orm/mongoose/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
3 changes: 2 additions & 1 deletion packages/orm/mongoose/src/decorators/numberDecimal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ describe("@NumberDecimal()", () => {
const result = deserialize({}, {type: Model, additionalProperties: false});

expect(result).toBeInstanceOf(Model);
expect(result).not.toHaveProperty("price");
expect(result).toHaveProperty("price");
expect(result.price).toEqual(undefined);
});
it("should deserialize a number value using custom decimal", () => {
// GIVEN
Expand Down
2 changes: 2 additions & 0 deletions packages/orm/objection/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
4 changes: 3 additions & 1 deletion packages/orm/prisma/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ src
test
tsconfig.compile.json
tsconfig.json
jest.config.js
jest.config.js
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/orm/testing-mongoose/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/orm/typeorm/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/perf/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/platform/common/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
6 changes: 3 additions & 3 deletions packages/platform/common/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module.exports = {
...require("@tsed/jest-config")(__dirname, "common"),
coverageThreshold: {
global: {
statements: 90.71,
statements: 90.67,
branches: 73.86,
functions: 84.22,
lines: 90.76
functions: 84.17,
lines: 90.71
}
}
};
2 changes: 2 additions & 0 deletions packages/platform/platform-aws/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/platform/platform-cache/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/platform/platform-exceptions/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 1 addition & 1 deletion packages/platform/platform-exceptions/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
coverageThreshold: {
global: {
statements: 100,
branches: 95.65,
branches: 94.73,
functions: 100,
lines: 100
}
Expand Down
2 changes: 2 additions & 0 deletions packages/platform/platform-express/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/platform/platform-koa/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/platform/platform-log-middleware/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 2 additions & 0 deletions packages/platform/platform-middlewares/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {DIConfiguration} from "@tsed/di/src/index";
import {DIConfiguration} from "@tsed/di";
import {getMiddlewaresForHook} from "./getMiddlewaresForHook";

describe("getMiddlewaresForHooks", () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/platform/platform-params/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ src
test
tsconfig.compile.json
tsconfig.json
__mock__
*.spec.js
2 changes: 1 addition & 1 deletion packages/platform/platform-params/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
coverageThreshold: {
global: {
statements: 89.92,
branches: 73.83,
branches: 73.78,
functions: 73.83,
lines: 89.47
}
Expand Down
Loading

0 comments on commit 44fd0ae

Please sign in to comment.