Skip to content

Commit a2e1669

Browse files
committed
Updated dependencies, including TypeORM 0.3.10
1 parent 4565f66 commit a2e1669

File tree

5 files changed

+3855
-5614
lines changed

5 files changed

+3855
-5614
lines changed

package.json

+26-29
Original file line numberDiff line numberDiff line change
@@ -32,42 +32,39 @@
3232
"typecheck": "tsc --noEmit"
3333
},
3434
"devDependencies": {
35-
"@semantic-release/git": "^9.0.0",
35+
"@semantic-release/git": "^9.0.1",
3636
"@types/bcryptjs": "^2.4.2",
37-
"@types/chalk": "^2.2.0",
38-
"@types/faker": "^5.5.8",
39-
"@types/glob": "7.1.1",
40-
"@types/jest": "^25.2.1",
41-
"@types/node": "13.11.1",
42-
"@types/yargs": "^15.0.4",
43-
"@typescript-eslint/eslint-plugin": "^2.27.0",
44-
"@typescript-eslint/parser": "^2.27.0",
37+
"@types/faker": "^5.5.3",
38+
"@types/glob": "^8.0.0",
39+
"@types/jest": "^29.0.3",
40+
"@types/node": "16.11.65",
41+
"@types/yargs": "^17.0.3",
42+
"@typescript-eslint/eslint-plugin": "^5.40.0",
43+
"@typescript-eslint/parser": "^5.40.0",
4544
"bcryptjs": "^2.4.3",
46-
"eslint": "^6.8.0",
47-
"eslint-config-prettier": "^6.10.1",
48-
"eslint-plugin-import": "^2.20.2",
49-
"jest": "^25.3.0",
50-
"prettier": "^2.0.4",
45+
"eslint": "^8.25.0",
46+
"eslint-config-prettier": "^8.5.0",
47+
"eslint-plugin-import": "^2.26.0",
48+
"jest": "^29.1.2",
49+
"prettier": "^2.7.1",
5150
"rimraf": "^3.0.2",
52-
"semantic-release": "^17.0.4",
53-
"sqlite": "^4.0.6",
54-
"sqlite3": "^4.1.1",
55-
"ts-jest": "^25.3.1",
56-
"typeorm": "^0.2.24",
57-
"typescript": "^3.8.3"
51+
"semantic-release": "^19.0.5",
52+
"sqlite": "^4.1.2",
53+
"sqlite3": "^5.1.2",
54+
"ts-jest": "^29.0.3",
55+
"typeorm": "^0.3.10",
56+
"typescript": "^4.8.4"
5857
},
5958
"dependencies": {
6059
"chalk": "^4.0.0",
61-
"faker": "5.5.3",
62-
"glob": "7.1.6",
63-
"ora": "4.0.3",
64-
"reflect-metadata": "0.1.13",
65-
"yargs": "15.3.1"
60+
"faker": "^5.5.3",
61+
"glob": "^8.0.3",
62+
"mem": "^9.0.2",
63+
"ora": "^4.0.3",
64+
"reflect-metadata": "^0.1.13",
65+
"yargs": "^17.6.0"
6666
},
6767
"peerDependencies": {
68-
"typeorm": "^0.2.24"
69-
},
70-
"resolutions": {
71-
"mem": ">=4.0.0"
68+
"typeorm": "^0.3.10"
7269
}
7370
}

sample/test/sample.integration.test.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,23 @@ import { Connection } from 'typeorm'
1010

1111
describe('Sample Integration Test', () => {
1212
let connection: Connection
13-
beforeAll(async (done) => {
13+
beforeAll(async () => {
1414
setConnectionOptions({
1515
type: 'sqlite',
1616
database: ':memory:',
1717
entities: ['sample/entities/**/*{.ts,.js}'],
1818
})
1919
connection = await useRefreshDatabase()
2020
await useSeeding()
21-
done()
2221
})
2322

24-
afterAll(async (done) => {
23+
afterAll(async () => {
2524
await tearDownDatabase()
2625
})
2726

28-
test('Should create a user with the entity factory', async (done) => {
27+
test('Should create a user with the entity factory', async () => {
2928
const createdUser = await factory(User)().create()
30-
const user = await connection.getRepository(User).findOne(createdUser.id)
29+
const user = await connection.getRepository(User).findOne({ where: { id: createdUser.id } })
3130
expect(createdUser.firstName).toBe(user.firstName)
32-
done()
3331
})
3432
})

src/entity-factory.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as Faker from 'faker'
2-
import { ObjectType, SaveOptions } from 'typeorm'
2+
import { ObjectLiteral, ObjectType, SaveOptions } from 'typeorm'
33
import { FactoryFunction, EntityProperty } from './types'
44
import { isPromiseLike } from './utils/factory.util'
55
import { printError, printWarning } from './utils/log.util'
66
import { getConnectionOptions, createConnection } from './connection'
77

8-
export class EntityFactory<Entity, Context> {
8+
export class EntityFactory<Entity extends ObjectLiteral, Context> {
99
private mapFunction: (entity: Entity) => Promise<Entity>
1010

1111
constructor(
@@ -59,7 +59,7 @@ export class EntityFactory<Entity, Context> {
5959
}
6060

6161
public async makeMany(amount: number, overrideParams: EntityProperty<Entity> = {}): Promise<Entity[]> {
62-
const list = []
62+
const list: Entity[] = []
6363
for (let index = 0; index < amount; index++) {
6464
list[index] = await this.make(overrideParams)
6565
}
@@ -71,7 +71,7 @@ export class EntityFactory<Entity, Context> {
7171
overrideParams: EntityProperty<Entity> = {},
7272
saveOptions?: SaveOptions,
7373
): Promise<Entity[]> {
74-
const list = []
74+
const list: Entity[] = []
7575
for (let index = 0; index < amount; index++) {
7676
list[index] = await this.create(overrideParams, saveOptions)
7777
}

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
3-
"lib": ["es5", "es6"],
4-
"target": "es5",
3+
"lib": ["dom", "es5", "es6"],
4+
"target": "es6",
55
"module": "commonjs",
66
"outDir": "./dist",
77
"moduleResolution": "node",

0 commit comments

Comments
 (0)