fastypest 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,39 +1,42 @@
1
- <h1 align="center">FASTYPEST</h1>
2
- <p align="center">
3
- <a href="https://www.npmjs.com/fastypest" target="_blank"><img alt="GitHub package.json version" src="https://img.shields.io/github/package-json/v/juanjo96dev/fastypest?logo=github&logoColor=fff&label=GitHub+package"></a>
4
- <a href="https://www.npmjs.com/fastypest" target="_blank"><img alt="npm" src="https://img.shields.io/npm/v/fastypest?logo=npm&logoColor=fff&label=NPM+package"></a>
5
- <a href="https://www.npmjs.com/fastypest" target="_blank"><img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/fastypest/peer/typeorm"></a>
6
- <a href="https://www.npmjs.com/fastypest" target="_blank"><img alt="Node version" src="https://img.shields.io/node/v/fastypest"></a>
7
- <a href="https://www.npmjs.com/fastypest" target="_blank"><img src="https://img.shields.io/npm/l/fastypest" alt="Package License" /></a>
8
- <a href="https://www.npmjs.com/fastypest" target="_blank"><img src="https://img.shields.io/npm/dm/fastypest" alt="NPM Downloads" /></a>
9
- </p>
10
-
11
- With this library, you can run your test suites without having to stop and restore the database in between them.
12
-
13
- Currently compatible with:
14
-
15
- - <a href="https://www.npmjs.com/fastypest"><img alt="MySQL >= v5.7 supported" src="https://img.shields.io/badge/MySQL-%3E%3D5.7-informational"></a>
16
- - <a href="https://www.npmjs.com/fastypest"><img alt="MariaDB >= v10.0 supported" src="https://img.shields.io/badge/MariaDB-%3E%3D10.0-yellowgreen"></a>
17
- - <a href="https://www.npmjs.com/fastypest"><img alt="Postgres >= v9.0 supported" src="https://img.shields.io/badge/Postgres-%3E%3D9.0-green"></a>
18
- - <a href="https://www.npmjs.com/fastypest"><img alt="cockroachDB >= v22.2.0 supported" src="https://img.shields.io/badge/CockroachDB-%3E%3D22.2.0-blue"></a>
19
-
20
- Install with npm
21
-
22
- ```
23
- npm i -D fastypest
24
- ```
25
-
26
- To use it, you must have inserted all the seeds beforehand, and before starting the tests, you must initialize it by indicating the typeorm connection configuration. You must execute restoreData after each test, so that the database is returned to its initial state.
27
-
28
- Example of use with jest:
29
-
30
- ```typescript
31
- beforeAll(async () => {
32
- fastypest = new Fastypest(connection);
33
- await fastypest.init();
34
- });
35
-
36
- afterEach(async () => {
37
- await fastypest.restoreData();
38
- });
39
- ```
1
+ <h1 align="center">FASTYPEST</h1>
2
+ <p align="center">
3
+ <a href="https://www.npmjs.com/fastypest" target="_blank"><img alt="GitHub package.json version" src="https://img.shields.io/github/package-json/v/juanjoGonDev/fastypest?logo=github&logoColor=fff&label=GitHub+package"></a>
4
+ <a href="https://www.npmjs.com/fastypest" target="_blank"><img alt="npm" src="https://img.shields.io/npm/v/fastypest?logo=npm&logoColor=fff&label=NPM+package"></a>
5
+ <a href="https://www.npmjs.com/fastypest" target="_blank"><img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/fastypest/peer/typeorm"></a>
6
+ <a href="https://www.npmjs.com/fastypest" target="_blank"><img alt="Node version" src="https://img.shields.io/node/v/fastypest"></a>
7
+ <a href="https://www.npmjs.com/fastypest" target="_blank"><img src="https://img.shields.io/npm/l/fastypest" alt="Package License" /></a>
8
+ <a href="https://www.npmjs.com/fastypest" target="_blank"><img src="https://img.shields.io/npm/dm/fastypest" alt="NPM Downloads" /></a>
9
+ </p>
10
+
11
+ With this library, you can run your test suites without having to stop and restore the database in between them.
12
+
13
+ Currently compatible with:
14
+
15
+ - <a href="https://www.npmjs.com/fastypest"><img alt="MySQL >= v5.7 supported" src="https://img.shields.io/badge/MySQL-%3E%3D5.7-informational"></a>
16
+ - <a href="https://www.npmjs.com/fastypest"><img alt="MariaDB >= v10.0 supported" src="https://img.shields.io/badge/MariaDB-%3E%3D10.0-yellowgreen"></a>
17
+ - <a href="https://www.npmjs.com/fastypest"><img alt="Postgres >= v9.0 supported" src="https://img.shields.io/badge/Postgres-%3E%3D9.0-green"></a>
18
+ - <a href="https://www.npmjs.com/fastypest"><img alt="cockroachDB >= v22.2.0 supported" src="https://img.shields.io/badge/CockroachDB-%3E%3D22.2.0-blue"></a>
19
+
20
+ Install with npm
21
+
22
+ ```
23
+ npm i -D fastypest
24
+ ```
25
+
26
+ To use it, you must have inserted all the seeds beforehand, and before starting the tests, you must initialize it by indicating the typeorm connection configuration. You must execute restoreData after each test, so that the database is returned to its initial state.
27
+
28
+ Example of use with jest
29
+
30
+ > **Note**
31
+ > (I recommend using it in a [setupFilesAfterEnv](https://jestjs.io/es-ES/docs/configuration#setupfilesafterenv-array) file):
32
+
33
+ ```typescript
34
+ beforeAll(async () => {
35
+ fastypest = new Fastypest(connection);
36
+ await fastypest.init();
37
+ });
38
+
39
+ afterEach(async () => {
40
+ await fastypest.restoreData();
41
+ });
42
+ ```
@@ -1,5 +1,12 @@
1
1
  import { Connection, DataSource, EntityManager } from "typeorm";
2
2
  import { SQLScript } from "./sql-script";
3
+ interface Manager {
4
+ foreignKey: {
5
+ disable: () => Promise<string | object>;
6
+ enable: () => Promise<string | object>;
7
+ };
8
+ dependencyTree: () => Promise<Set<string> | undefined>;
9
+ }
3
10
  export declare class Fastypest extends SQLScript {
4
11
  private manager;
5
12
  private tables;
@@ -8,12 +15,7 @@ export declare class Fastypest extends SQLScript {
8
15
  detectTables(em: EntityManager): Promise<void>;
9
16
  restoreData(): Promise<void>;
10
17
  private restoreOrder;
11
- restoreManager(em: EntityManager): Promise<{
12
- foreignKey: {
13
- disable: () => Promise<{}>;
14
- enable: () => Promise<{}>;
15
- };
16
- dependencyTree: () => Promise<undefined>;
17
- }>;
18
+ restoreManager(em: EntityManager): Promise<Manager>;
18
19
  clearTempTables(): Promise<void>;
19
20
  }
21
+ export {};
@@ -46,8 +46,8 @@ class Fastypest extends sql_script_1.SQLScript {
46
46
  }));
47
47
  });
48
48
  }
49
- restoreOrder(em, tables, type = "random") {
50
- return __awaiter(this, void 0, void 0, function* () {
49
+ restoreOrder(em_1, tables_1) {
50
+ return __awaiter(this, arguments, void 0, function* (em, tables, type = "random") {
51
51
  switch (type) {
52
52
  case "sorted":
53
53
  for (const tableName of tables) {
@@ -1 +1 @@
1
- {"version":3,"file":"fastypest.js","sourceRoot":"","sources":["../../src/core/fastypest.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,6CAAyC;AAEzC,MAAa,SAAU,SAAQ,sBAAS;IAItC,YAAY,UAAmC;QAC7C,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAHzB,WAAM,GAAgB,IAAI,GAAG,EAAE,CAAC;QAItC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IACpC,CAAC;IAEK,IAAI;;YACR,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAO,EAAE,EAAE,EAAE;gBAC1C,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;gBAE5B,MAAM,OAAO,CAAC,GAAG,CACf,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAO,SAAS,EAAE,EAAE;oBACvC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;gBAClE,CAAC,CAAA,CAAC,CACH,CAAC;YACJ,CAAC,CAAA,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,YAAY,CAAC,EAAiB;;YAClC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAC9C,CAAC,GAA2B,EAAE,EAAE;gBAC9B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC,CACF,CAAC;QACJ,CAAC;KAAA;IAEK,WAAW;;YACf,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CA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AC;IAClB,CAAC;CACF;AAjCD,8BAiCC"}
1
+ {"version":3,"file":"sql-script.js","sourceRoot":"","sources":["../../../src/core/sql-script/sql-script.ts"],"names":[],"mappings":";;;AACA,uCAAkE;AAKlE,MAAa,SAAS;IAEpB,YAAqB,IAAa;QAAb,SAAI,GAAJ,IAAI,CAAS;QAChC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,oBAAU,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CACb,kFAAkF,MAAM,CAAC,IAAI,CAC3F,oBAAU,CACX,EAAE,CACJ,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,oBAAU,CAAC,IAAI,CAAC,IAAwB,CAAC,CAAC;IAC3D,CAAC;IAED,QAAQ,CACN,SAA6B,EAC7B,MAA+B;QAE/B,MAAM,QAAQ,GAAG,SAAS;aACvB,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,CAAC,GAAQ,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAErD,IAAI,QAAQ,GAAG,QAAQ,CAAC;QAExB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;YACzB,QAAQ,GAAG,QAAQ,CAAC,OAAO,CACzB,IAAI,MAAM,CAAC,SAAS,GAAG,QAAQ,EAAE,GAAG,CAAC,EACrC,MAAM,CAAC,GAAG,CAAC,CACZ,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAjCD,8BAiCC"}
@@ -1,6 +1,6 @@
1
1
  type JsonKeys<T> = T extends object ? {
2
2
  [K in keyof T]-?: `${string & K}` | `${JsonKeys<T[K]> & `.${string & K}`}`;
3
3
  }[keyof T] : "";
4
- type FlattenJson<T, K = JsonKeys<T>> = K extends keyof T ? T[K] extends Record<string, any> ? `${string & K}.${FlattenJson<T[K]>}` : K : never;
4
+ type FlattenJson<T, K = JsonKeys<T>> = K extends keyof T ? T[K] extends Record<string, string | object> ? `${string & K}.${FlattenJson<T[K]>}` : K : never;
5
5
  export type QueryPath<T> = FlattenJson<T>;
6
6
  export {};
@@ -0,0 +1,28 @@
1
+ import pluginJs from "@eslint/js";
2
+ import globals from "globals";
3
+ import tseslint from "typescript-eslint";
4
+
5
+ const common = {
6
+ files: ["src/**/*.ts"],
7
+ ignores: ["**/dist/*", "**/node_modules/*"],
8
+ rules: {
9
+ "no-case-declarations": "off",
10
+ },
11
+ };
12
+
13
+ const tsRecommended = tseslint.configs.recommended.map((config) => ({
14
+ ...config,
15
+ ...common,
16
+ }));
17
+
18
+ export default [
19
+ {
20
+ languageOptions: { globals: globals.node },
21
+ ...common,
22
+ },
23
+ {
24
+ ...pluginJs.configs.recommended,
25
+ ...common,
26
+ },
27
+ ...tsRecommended,
28
+ ];
package/package.json CHANGED
@@ -1,69 +1,82 @@
1
- {
2
- "name": "fastypest",
3
- "version": "1.3.0",
4
- "description": "Restores the database automatically after each test. Allows serial execution of tests without having to delete and restore the database having to stop the application",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "engines": {
8
- "node": ">=18"
9
- },
10
- "volta": {
11
- "node": "18.0.0"
12
- },
13
- "scripts": {
14
- "prebuild": "rimraf dist",
15
- "build": "tsc",
16
- "eslint": "eslint . --fix --config .eslintrc",
17
- "pretest": "tsc",
18
- "test": "jest --runInBand --config ./jest.config.json",
19
- "docker": "ts-node -r tsconfig-paths/register scripts/prepare-docker.ts"
20
- },
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/juanjo96Dev/fastypest.git"
24
- },
25
- "keywords": [
26
- "typeorm",
27
- "test",
28
- "transaction",
29
- "rollback",
30
- "nestjs",
31
- "restore",
32
- "db",
33
- "speed",
34
- "up",
35
- "tests",
36
- "jest",
37
- "fastypest"
38
- ],
39
- "author": "juanjo96Dev",
40
- "license": "GPL",
41
- "bugs": {
42
- "url": "https://github.com/juanjo96Dev/fastypest/issues"
43
- },
44
- "homepage": "https://github.com/juanjo96Dev/fastypest#readme",
45
- "devDependencies": {
46
- "@types/cross-spawn": "^6.0.2",
47
- "@types/jest": "^29.5.0",
48
- "@types/node": "^18.15.11",
49
- "@typescript-eslint/eslint-plugin": "^5.58.0",
50
- "cross-spawn": "^7.0.3",
51
- "eslint": "^8.38.0",
52
- "eslint-config-standard-with-typescript": "^34.0.1",
53
- "eslint-plugin-import": "^2.27.5",
54
- "eslint-plugin-n": "^15.7.0",
55
- "eslint-plugin-prettier": "^4.2.1",
56
- "eslint-plugin-promise": "^6.1.1",
57
- "jest": "^29.5.0",
58
- "mariadb": "^3.1.1",
59
- "mysql": "^2.18.1",
60
- "pg": "^8.10.0",
61
- "rimraf": "^5.0.0",
62
- "ts-jest": "^29.1.0",
63
- "ts-node": "^10.9.1",
64
- "typescript": "^5.0.4"
65
- },
66
- "peerDependencies": {
67
- "typeorm": "^0.3.14"
68
- }
69
- }
1
+ {
2
+ "name": "fastypest",
3
+ "version": "1.3.2",
4
+ "description": "Restores the database automatically after each test. Allows serial execution of tests without having to delete and restore the database having to stop the application",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "engines": {
8
+ "node": ">=18.18.0"
9
+ },
10
+ "packageManager": "yarn@4.2.2",
11
+ "volta": {
12
+ "node": "18.18.0",
13
+ "yarn": "4.2.2"
14
+ },
15
+ "installConfig": {
16
+ "pnp": false
17
+ },
18
+ "scripts": {
19
+ "prebuild": "rimraf dist",
20
+ "build": "tsc",
21
+ "eslint": "eslint --fix .",
22
+ "pretest": "tsc",
23
+ "test": "jest --runInBand --config ./jest.config.json",
24
+ "docker": "ts-node -r tsconfig-paths/register scripts/prepare-docker.ts",
25
+ "release": "standard-version --release-as patch",
26
+ "publish": "npm publish"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/juanjoGonDev/fastypest.git"
31
+ },
32
+ "keywords": [
33
+ "typeorm",
34
+ "test",
35
+ "transaction",
36
+ "rollback",
37
+ "nestjs",
38
+ "restore",
39
+ "db",
40
+ "speed",
41
+ "up",
42
+ "tests",
43
+ "jest",
44
+ "fastypest"
45
+ ],
46
+ "author": "juanjoGonDev",
47
+ "license": "GPL",
48
+ "bugs": {
49
+ "url": "https://github.com/juanjoGonDev/fastypest/issues"
50
+ },
51
+ "homepage": "https://github.com/juanjoGonDev/fastypest#readme",
52
+ "devDependencies": {
53
+ "@eslint/js": "^9.2.0",
54
+ "@types/cross-spawn": "^6.0.6",
55
+ "@types/jest": "^29.5.12",
56
+ "@types/node": "^20.12.11",
57
+ "@typescript-eslint/eslint-plugin": "^7.8.0",
58
+ "cross-spawn": "^7.0.3",
59
+ "eslint": "^9.2.0",
60
+ "eslint-config-standard-with-typescript": "^43.0.1",
61
+ "eslint-plugin-import": "^2.29.1",
62
+ "eslint-plugin-n": "^17.5.1",
63
+ "eslint-plugin-prettier": "^5.1.3",
64
+ "eslint-plugin-promise": "^6.1.1",
65
+ "globals": "^15.2.0",
66
+ "jest": "^29.7.0",
67
+ "mariadb": "^3.3.0",
68
+ "mysql": "^2.18.1",
69
+ "pg": "^8.11.5",
70
+ "rimraf": "^5.0.5",
71
+ "standard-version": "^9.5.0",
72
+ "ts-jest": "^29.1.2",
73
+ "ts-node": "^10.9.2",
74
+ "tsconfig-paths": "^4.2.0",
75
+ "typeorm": "^0.3.20",
76
+ "typescript": "^5.4.5",
77
+ "typescript-eslint": "^7.8.0"
78
+ },
79
+ "peerDependencies": {
80
+ "typeorm": "^0.3.20"
81
+ }
82
+ }