fragment-ts 1.0.17 → 1.0.19
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/SETUP.md +570 -0
- package/changes/1.md +469 -0
- package/dist/cli/commands/init.command.js +4 -4
- package/dist/cli/commands/init.command.js.map +1 -1
- package/dist/cli/commands/test.command.d.ts +6 -0
- package/dist/cli/commands/test.command.d.ts.map +1 -0
- package/dist/cli/commands/test.command.js +311 -0
- package/dist/cli/commands/test.command.js.map +1 -0
- package/dist/cli/index.js +6 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/core/container/di-container.d.ts +5 -0
- package/dist/core/container/di-container.d.ts.map +1 -1
- package/dist/core/container/di-container.js +121 -21
- package/dist/core/container/di-container.js.map +1 -1
- package/dist/core/decorators/controller.decorator.js +5 -5
- package/dist/core/decorators/injection.decorators.d.ts +44 -1
- package/dist/core/decorators/injection.decorators.d.ts.map +1 -1
- package/dist/core/decorators/injection.decorators.js +92 -1
- package/dist/core/decorators/injection.decorators.js.map +1 -1
- package/dist/core/metadata/metadata-keys.d.ts +29 -17
- package/dist/core/metadata/metadata-keys.d.ts.map +1 -1
- package/dist/core/metadata/metadata-keys.js +35 -17
- package/dist/core/metadata/metadata-keys.js.map +1 -1
- package/dist/testing/runner.d.ts +10 -0
- package/dist/testing/runner.d.ts.map +1 -1
- package/dist/testing/runner.js +109 -16
- package/dist/testing/runner.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/init.command.ts +4 -4
- package/src/cli/commands/test.command.ts +289 -0
- package/src/cli/index.ts +16 -11
- package/src/core/container/di-container.ts +166 -31
- package/src/core/decorators/DECORATOR_USAGE.md +326 -0
- package/src/core/decorators/controller.decorator.ts +9 -9
- package/src/core/decorators/injection.decorators.ts +129 -5
- package/src/core/metadata/metadata-keys.ts +44 -18
- package/src/testing/TEST.md +321 -0
- package/src/testing/runner.ts +137 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injection.decorators.d.ts","sourceRoot":"","sources":["../../../src/core/decorators/injection.decorators.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,IAAI,iBAAiB,
|
|
1
|
+
{"version":3,"file":"injection.decorators.d.ts","sourceRoot":"","sources":["../../../src/core/decorators/injection.decorators.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,SAAS,IAAI,iBAAiB,CAe7C;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,iBAAiB,CAIlE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,GAAG,iBAAiB,CASpE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAIzD;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,CAS3D;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAI5C;AAED;;;GAGG;AACH,wBAAgB,IAAI,IAAI,iBAAiB,CAwBxC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAY/C;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,eAAe,CAY5C"}
|
|
@@ -2,28 +2,119 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Autowired = Autowired;
|
|
4
4
|
exports.Inject = Inject;
|
|
5
|
+
exports.InjectRepository = InjectRepository;
|
|
5
6
|
exports.Qualifier = Qualifier;
|
|
6
7
|
exports.Value = Value;
|
|
8
|
+
exports.Optional = Optional;
|
|
9
|
+
exports.Lazy = Lazy;
|
|
10
|
+
exports.PostConstruct = PostConstruct;
|
|
11
|
+
exports.PreDestroy = PreDestroy;
|
|
7
12
|
const metadata_keys_1 = require("../metadata/metadata-keys");
|
|
13
|
+
/**
|
|
14
|
+
* @Autowired - Automatically inject dependencies by type
|
|
15
|
+
* Usage: @Autowired() private myService: MyService;
|
|
16
|
+
*/
|
|
8
17
|
function Autowired() {
|
|
9
18
|
return (target, propertyKey) => {
|
|
10
|
-
|
|
19
|
+
// Get the design type from TypeScript metadata
|
|
20
|
+
const type = Reflect.getMetadata("design:type", target, propertyKey);
|
|
21
|
+
if (!type || type === Object) {
|
|
22
|
+
throw new Error(`Cannot use @Autowired on property "${String(propertyKey)}" in ${target.constructor.name}. ` +
|
|
23
|
+
`Make sure TypeScript emitDecoratorMetadata is enabled and the type is explicitly declared.`);
|
|
24
|
+
}
|
|
25
|
+
// Store the type in metadata so DI container can resolve it
|
|
11
26
|
Reflect.defineMetadata(metadata_keys_1.METADATA_KEYS.AUTOWIRED, type, target, propertyKey);
|
|
12
27
|
};
|
|
13
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* @Inject - Inject dependency by token (string or class)
|
|
31
|
+
* Usage: @Inject('MyService') private service: MyService;
|
|
32
|
+
* or: @Inject(MyService) private service: MyService;
|
|
33
|
+
*/
|
|
14
34
|
function Inject(token) {
|
|
15
35
|
return (target, propertyKey) => {
|
|
16
36
|
Reflect.defineMetadata(metadata_keys_1.METADATA_KEYS.INJECT, token, target, propertyKey);
|
|
17
37
|
};
|
|
18
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* @InjectRepository - Inject TypeORM repository for an entity
|
|
41
|
+
* Usage: @InjectRepository(User) private userRepo: Repository<User>;
|
|
42
|
+
*/
|
|
43
|
+
function InjectRepository(entity) {
|
|
44
|
+
return (target, propertyKey) => {
|
|
45
|
+
Reflect.defineMetadata(metadata_keys_1.METADATA_KEYS.INJECT_REPOSITORY, entity, target, propertyKey);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @Qualifier - Specify which bean to inject when multiple exist
|
|
50
|
+
* Usage: @Qualifier('primary') @Autowired() private service: MyService;
|
|
51
|
+
*/
|
|
19
52
|
function Qualifier(name) {
|
|
20
53
|
return (target, propertyKey) => {
|
|
21
54
|
Reflect.defineMetadata(metadata_keys_1.METADATA_KEYS.QUALIFIER, name, target, propertyKey);
|
|
22
55
|
};
|
|
23
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* @Value - Inject configuration value from environment or config
|
|
59
|
+
* Usage: @Value('${PORT}') private port: number;
|
|
60
|
+
* or: @Value('${DB_HOST:localhost}') private host: string;
|
|
61
|
+
*/
|
|
24
62
|
function Value(expression) {
|
|
25
63
|
return (target, propertyKey) => {
|
|
26
64
|
Reflect.defineMetadata(metadata_keys_1.METADATA_KEYS.VALUE, expression, target, propertyKey);
|
|
27
65
|
};
|
|
28
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* @Optional - Mark dependency as optional (won't throw if not found)
|
|
69
|
+
* Usage: @Optional() @Autowired() private service?: MyService;
|
|
70
|
+
*/
|
|
71
|
+
function Optional() {
|
|
72
|
+
return (target, propertyKey) => {
|
|
73
|
+
Reflect.defineMetadata(metadata_keys_1.METADATA_KEYS.OPTIONAL, true, target, propertyKey);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @Lazy - Lazy load dependency (create on first access)
|
|
78
|
+
* Usage: @Lazy() @Autowired() private service: MyService;
|
|
79
|
+
*/
|
|
80
|
+
function Lazy() {
|
|
81
|
+
return (target, propertyKey) => {
|
|
82
|
+
Reflect.defineMetadata(metadata_keys_1.METADATA_KEYS.LAZY, true, target, propertyKey);
|
|
83
|
+
const type = Reflect.getMetadata("design:type", target, propertyKey);
|
|
84
|
+
// Create a getter that resolves on first access
|
|
85
|
+
let cached = null;
|
|
86
|
+
let resolved = false;
|
|
87
|
+
Object.defineProperty(target, propertyKey, {
|
|
88
|
+
get() {
|
|
89
|
+
if (!resolved) {
|
|
90
|
+
const { DIContainer } = require("../container/di-container");
|
|
91
|
+
const container = DIContainer.getInstance();
|
|
92
|
+
cached = container.resolve(type);
|
|
93
|
+
resolved = true;
|
|
94
|
+
}
|
|
95
|
+
return cached;
|
|
96
|
+
},
|
|
97
|
+
enumerable: true,
|
|
98
|
+
configurable: true,
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @PostConstruct - Method called after dependency injection is complete
|
|
104
|
+
* Usage: @PostConstruct() init() { ... }
|
|
105
|
+
*/
|
|
106
|
+
function PostConstruct() {
|
|
107
|
+
return (target, propertyKey, descriptor) => {
|
|
108
|
+
Reflect.defineMetadata(metadata_keys_1.METADATA_KEYS.POST_CONSTRUCT, propertyKey, target.constructor);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @PreDestroy - Method called before bean is destroyed
|
|
113
|
+
* Usage: @PreDestroy() cleanup() { ... }
|
|
114
|
+
*/
|
|
115
|
+
function PreDestroy() {
|
|
116
|
+
return (target, propertyKey, descriptor) => {
|
|
117
|
+
Reflect.defineMetadata(metadata_keys_1.METADATA_KEYS.PRE_DESTROY, propertyKey, target.constructor);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
29
120
|
//# sourceMappingURL=injection.decorators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injection.decorators.js","sourceRoot":"","sources":["../../../src/core/decorators/injection.decorators.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"injection.decorators.js","sourceRoot":"","sources":["../../../src/core/decorators/injection.decorators.ts"],"names":[],"mappings":";;AAMA,8BAeC;AAOD,wBAIC;AAMD,4CASC;AAMD,8BAIC;AAOD,sBASC;AAMD,4BAIC;AAMD,oBAwBC;AAMD,sCAYC;AAMD,gCAYC;AArJD,6DAA0D;AAE1D;;;GAGG;AACH,SAAgB,SAAS;IACvB,OAAO,CAAC,MAAW,EAAE,WAA4B,EAAE,EAAE;QACnD,+CAA+C;QAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAErE,IAAI,CAAC,IAAI,IA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AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,UAAU;IACxB,OAAO,CACL,MAAW,EACX,WAA4B,EAC5B,UAA8B,EAC9B,EAAE;QACF,OAAO,CAAC,cAAc,CACpB,6BAAa,CAAC,WAAW,EACzB,WAAW,EACX,MAAM,CAAC,WAAW,CACnB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
export declare const METADATA_KEYS: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
REPOSITORY:
|
|
7
|
-
AUTO_CONFIGURATION:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
readonly APPLICATION: "fragment:application";
|
|
3
|
+
readonly INJECTABLE: "fragment:injectable";
|
|
4
|
+
readonly CONTROLLER: "fragment:controller";
|
|
5
|
+
readonly SERVICE: "fragment:service";
|
|
6
|
+
readonly REPOSITORY: "fragment:repository";
|
|
7
|
+
readonly AUTO_CONFIGURATION: "fragment:auto-configuration";
|
|
8
|
+
readonly SCOPE: "fragment:scope";
|
|
9
|
+
readonly AUTOWIRED: "fragment:autowired";
|
|
10
|
+
readonly INJECT: "fragment:inject";
|
|
11
|
+
readonly INJECT_REPOSITORY: "fragment:inject-repository";
|
|
12
|
+
readonly QUALIFIER: "fragment:qualifier";
|
|
13
|
+
readonly VALUE: "fragment:value";
|
|
14
|
+
readonly OPTIONAL: "fragment:optional";
|
|
15
|
+
readonly LAZY: "fragment:lazy";
|
|
16
|
+
readonly HTTP_METHOD: "fragment:http-method";
|
|
17
|
+
readonly ROUTE_PATH: "fragment:route-path";
|
|
18
|
+
readonly POST_CONSTRUCT: "fragment:post-construct";
|
|
19
|
+
readonly PRE_DESTROY: "fragment:pre-destroy";
|
|
20
|
+
readonly PARAM_METADATA: "fragment:param-metadata";
|
|
21
|
+
readonly CONDITIONAL_ON_CLASS: "fragment:conditional-on-class";
|
|
22
|
+
readonly CONDITIONAL_ON_MISSING_BEAN: "fragment:conditional-on-missing-bean";
|
|
23
|
+
readonly CONDITIONAL_ON_PROPERTY: "fragment:conditional-on-property";
|
|
24
|
+
readonly CONDITIONAL_ON_BEAN: "fragment:conditional-on-bean";
|
|
25
|
+
readonly USE_GUARDS: "fragment:use-guards";
|
|
26
|
+
readonly USE_INTERCEPTORS: "fragment:use-interceptors";
|
|
27
|
+
readonly USE_FILTERS: "fragment:use-filters";
|
|
28
|
+
readonly VALIDATE: "fragment:validate";
|
|
29
|
+
readonly TRANSFORM: "fragment:transform";
|
|
19
30
|
};
|
|
31
|
+
export type MetadataKey = (typeof METADATA_KEYS)[keyof typeof METADATA_KEYS];
|
|
20
32
|
//# sourceMappingURL=metadata-keys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-keys.d.ts","sourceRoot":"","sources":["../../../src/core/metadata/metadata-keys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"metadata-keys.d.ts","sourceRoot":"","sources":["../../../src/core/metadata/metadata-keys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0ChB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -2,22 +2,40 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.METADATA_KEYS = void 0;
|
|
4
4
|
exports.METADATA_KEYS = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
CONTROLLER:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
AUTOWIRED:
|
|
15
|
-
INJECT:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
// Class decorators
|
|
6
|
+
APPLICATION: "fragment:application",
|
|
7
|
+
INJECTABLE: "fragment:injectable",
|
|
8
|
+
CONTROLLER: "fragment:controller",
|
|
9
|
+
SERVICE: "fragment:service",
|
|
10
|
+
REPOSITORY: "fragment:repository",
|
|
11
|
+
AUTO_CONFIGURATION: "fragment:auto-configuration",
|
|
12
|
+
SCOPE: "fragment:scope",
|
|
13
|
+
// Property decorators
|
|
14
|
+
AUTOWIRED: "fragment:autowired",
|
|
15
|
+
INJECT: "fragment:inject",
|
|
16
|
+
INJECT_REPOSITORY: "fragment:inject-repository",
|
|
17
|
+
QUALIFIER: "fragment:qualifier",
|
|
18
|
+
VALUE: "fragment:value",
|
|
19
|
+
OPTIONAL: "fragment:optional",
|
|
20
|
+
LAZY: "fragment:lazy",
|
|
21
|
+
// Method decorators
|
|
22
|
+
HTTP_METHOD: "fragment:http-method",
|
|
23
|
+
ROUTE_PATH: "fragment:route-path",
|
|
24
|
+
POST_CONSTRUCT: "fragment:post-construct",
|
|
25
|
+
PRE_DESTROY: "fragment:pre-destroy",
|
|
26
|
+
// Parameter decorators
|
|
27
|
+
PARAM_METADATA: "fragment:param-metadata",
|
|
28
|
+
// Conditional decorators
|
|
29
|
+
CONDITIONAL_ON_CLASS: "fragment:conditional-on-class",
|
|
30
|
+
CONDITIONAL_ON_MISSING_BEAN: "fragment:conditional-on-missing-bean",
|
|
31
|
+
CONDITIONAL_ON_PROPERTY: "fragment:conditional-on-property",
|
|
32
|
+
CONDITIONAL_ON_BEAN: "fragment:conditional-on-bean",
|
|
33
|
+
// Middleware & Guards
|
|
34
|
+
USE_GUARDS: "fragment:use-guards",
|
|
35
|
+
USE_INTERCEPTORS: "fragment:use-interceptors",
|
|
36
|
+
USE_FILTERS: "fragment:use-filters",
|
|
37
|
+
// Validation
|
|
38
|
+
VALIDATE: "fragment:validate",
|
|
39
|
+
TRANSFORM: "fragment:transform",
|
|
22
40
|
};
|
|
23
41
|
//# sourceMappingURL=metadata-keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-keys.js","sourceRoot":"","sources":["../../../src/core/metadata/metadata-keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,UAAU,EAAE,qBAAqB;IACjC,
|
|
1
|
+
{"version":3,"file":"metadata-keys.js","sourceRoot":"","sources":["../../../src/core/metadata/metadata-keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,mBAAmB;IACnB,WAAW,EAAE,sBAAsB;IACnC,UAAU,EAAE,qBAAqB;IACjC,UAAU,EAAE,qBAAqB;IACjC,OAAO,EAAE,kBAAkB;IAC3B,UAAU,EAAE,qBAAqB;IACjC,kBAAkB,EAAE,6BAA6B;IACjD,KAAK,EAAE,gBAAgB;IAEvB,sBAAsB;IACtB,SAAS,EAAE,oBAAoB;IAC/B,MAAM,EAAE,iBAAiB;IACzB,iBAAiB,EAAE,4BAA4B;IAC/C,SAAS,EAAE,oBAAoB;IAC/B,KAAK,EAAE,gBAAgB;IACvB,QAAQ,EAAE,mBAAmB;IAC7B,IAAI,EAAE,eAAe;IAErB,oBAAoB;IACpB,WAAW,EAAE,sBAAsB;IACnC,UAAU,EAAE,qBAAqB;IACjC,cAAc,EAAE,yBAAyB;IACzC,WAAW,EAAE,sBAAsB;IAEnC,uBAAuB;IACvB,cAAc,EAAE,yBAAyB;IAEzC,yBAAyB;IACzB,oBAAoB,EAAE,+BAA+B;IACrD,2BAA2B,EAAE,sCAAsC;IACnE,uBAAuB,EAAE,kCAAkC;IAC3D,mBAAmB,EAAE,8BAA8B;IAEnD,sBAAsB;IACtB,UAAU,EAAE,qBAAqB;IACjC,gBAAgB,EAAE,2BAA2B;IAC7C,WAAW,EAAE,sBAAsB;IAEnC,aAAa;IACb,QAAQ,EAAE,mBAAmB;IAC7B,SAAS,EAAE,oBAAoB;CACvB,CAAC"}
|
package/dist/testing/runner.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export interface TestSuite {
|
|
2
2
|
name: string;
|
|
3
3
|
tests: Test[];
|
|
4
|
+
beforeEachHooks: Array<() => void | Promise<void>>;
|
|
5
|
+
afterEachHooks: Array<() => void | Promise<void>>;
|
|
4
6
|
}
|
|
5
7
|
export interface Test {
|
|
6
8
|
name: string;
|
|
@@ -16,11 +18,19 @@ export declare class TestRunner {
|
|
|
16
18
|
}
|
|
17
19
|
export declare function describe(name: string, fn: () => void): void;
|
|
18
20
|
export declare function it(name: string, fn: () => void | Promise<void>): void;
|
|
21
|
+
export declare function beforeEach(fn: () => void | Promise<void>): void;
|
|
22
|
+
export declare function afterEach(fn: () => void | Promise<void>): void;
|
|
19
23
|
export declare function expect(actual: any): {
|
|
20
24
|
toBe(expected: any): void;
|
|
21
25
|
toEqual(expected: any): void;
|
|
22
26
|
toBeTruthy(): void;
|
|
23
27
|
toBeFalsy(): void;
|
|
24
28
|
toThrow(): void;
|
|
29
|
+
toBeInstanceOf(expected: any): void;
|
|
30
|
+
toContain(expected: any): void;
|
|
31
|
+
toHaveProperty(prop: string): void;
|
|
32
|
+
toBeNull(): void;
|
|
33
|
+
toBeUndefined(): void;
|
|
34
|
+
toHaveLength(expected: number): void;
|
|
25
35
|
};
|
|
26
36
|
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,eAAe,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,OAAO,C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exports.describe = describe;
|
|
38
38
|
exports.it = it;
|
|
39
|
+
exports.beforeEach = beforeEach;
|
|
40
|
+
exports.afterEach = afterEach;
|
|
39
41
|
exports.expect = expect;
|
|
40
42
|
const path = __importStar(require("path"));
|
|
41
43
|
const glob_1 = require("glob");
|
|
@@ -50,34 +52,54 @@ class TestRunner {
|
|
|
50
52
|
this.failed = 0;
|
|
51
53
|
}
|
|
52
54
|
describe(name, fn) {
|
|
53
|
-
const suite = {
|
|
55
|
+
const suite = {
|
|
56
|
+
name,
|
|
57
|
+
tests: [],
|
|
58
|
+
beforeEachHooks: [],
|
|
59
|
+
afterEachHooks: [],
|
|
60
|
+
};
|
|
54
61
|
this.suites.push(suite);
|
|
55
|
-
const currentSuite = suite;
|
|
56
62
|
const originalIt = G.it;
|
|
63
|
+
const originalBeforeEach = G.beforeEach;
|
|
64
|
+
const originalAfterEach = G.afterEach;
|
|
57
65
|
G.it = (testName, testFn) => {
|
|
58
|
-
|
|
66
|
+
suite.tests.push({ name: testName, fn: testFn });
|
|
67
|
+
};
|
|
68
|
+
G.beforeEach = (hook) => {
|
|
69
|
+
suite.beforeEachHooks.push(hook);
|
|
70
|
+
};
|
|
71
|
+
G.afterEach = (hook) => {
|
|
72
|
+
suite.afterEachHooks.push(hook);
|
|
59
73
|
};
|
|
60
74
|
fn();
|
|
61
75
|
G.it = originalIt;
|
|
76
|
+
G.beforeEach = originalBeforeEach;
|
|
77
|
+
G.afterEach = originalAfterEach;
|
|
62
78
|
}
|
|
63
79
|
async run() {
|
|
64
|
-
console.log(
|
|
80
|
+
console.log("\nRunning Fragment Tests\n");
|
|
65
81
|
for (const suite of this.suites) {
|
|
66
|
-
console.log(`\
|
|
82
|
+
console.log(`\nSuite: ${suite.name}`);
|
|
67
83
|
for (const test of suite.tests) {
|
|
68
84
|
try {
|
|
85
|
+
for (const hook of suite.beforeEachHooks) {
|
|
86
|
+
await hook();
|
|
87
|
+
}
|
|
69
88
|
await test.fn();
|
|
70
|
-
|
|
89
|
+
for (const hook of suite.afterEachHooks) {
|
|
90
|
+
await hook();
|
|
91
|
+
}
|
|
92
|
+
console.log(` PASS ${test.name}`);
|
|
71
93
|
this.passed++;
|
|
72
94
|
}
|
|
73
95
|
catch (error) {
|
|
74
|
-
console.log(`
|
|
75
|
-
console.error(` ${error}`);
|
|
96
|
+
console.log(` FAIL ${test.name}`);
|
|
97
|
+
console.error(` ${error?.message ?? error}`);
|
|
76
98
|
this.failed++;
|
|
77
99
|
}
|
|
78
100
|
}
|
|
79
101
|
}
|
|
80
|
-
console.log(`\
|
|
102
|
+
console.log(`\nResults: ${this.passed} passed, ${this.failed} failed\n`);
|
|
81
103
|
if (this.failed > 0) {
|
|
82
104
|
process.exit(1);
|
|
83
105
|
}
|
|
@@ -94,11 +116,32 @@ exports.TestRunner = TestRunner;
|
|
|
94
116
|
* Global test helpers
|
|
95
117
|
* ====================================================== */
|
|
96
118
|
function describe(name, fn) {
|
|
97
|
-
G.__testRunner
|
|
119
|
+
if (!G.__testRunner) {
|
|
120
|
+
throw new Error("TestRunner not initialized");
|
|
121
|
+
}
|
|
122
|
+
G.__testRunner.describe(name, fn);
|
|
98
123
|
}
|
|
99
124
|
function it(name, fn) {
|
|
100
|
-
|
|
125
|
+
if (!G.it) {
|
|
126
|
+
throw new Error('"it" must be called inside describe()');
|
|
127
|
+
}
|
|
128
|
+
G.it(name, fn);
|
|
129
|
+
}
|
|
130
|
+
function beforeEach(fn) {
|
|
131
|
+
if (!G.beforeEach) {
|
|
132
|
+
throw new Error('"beforeEach" must be called inside describe()');
|
|
133
|
+
}
|
|
134
|
+
G.beforeEach(fn);
|
|
101
135
|
}
|
|
136
|
+
function afterEach(fn) {
|
|
137
|
+
if (!G.afterEach) {
|
|
138
|
+
throw new Error('"afterEach" must be called inside describe()');
|
|
139
|
+
}
|
|
140
|
+
G.afterEach(fn);
|
|
141
|
+
}
|
|
142
|
+
/* ======================================================
|
|
143
|
+
* Expect / Assertions
|
|
144
|
+
* ====================================================== */
|
|
102
145
|
function expect(actual) {
|
|
103
146
|
return {
|
|
104
147
|
toBe(expected) {
|
|
@@ -107,8 +150,10 @@ function expect(actual) {
|
|
|
107
150
|
}
|
|
108
151
|
},
|
|
109
152
|
toEqual(expected) {
|
|
110
|
-
|
|
111
|
-
|
|
153
|
+
const a = JSON.stringify(actual);
|
|
154
|
+
const e = JSON.stringify(expected);
|
|
155
|
+
if (a !== e) {
|
|
156
|
+
throw new Error(`Expected ${a} to equal ${e}`);
|
|
112
157
|
}
|
|
113
158
|
},
|
|
114
159
|
toBeTruthy() {
|
|
@@ -122,12 +167,54 @@ function expect(actual) {
|
|
|
122
167
|
}
|
|
123
168
|
},
|
|
124
169
|
toThrow() {
|
|
170
|
+
if (typeof actual !== "function") {
|
|
171
|
+
throw new Error("toThrow expects a function");
|
|
172
|
+
}
|
|
173
|
+
let threw = false;
|
|
125
174
|
try {
|
|
126
175
|
actual();
|
|
127
|
-
throw new Error('Expected function to throw');
|
|
128
176
|
}
|
|
129
177
|
catch {
|
|
130
|
-
|
|
178
|
+
threw = true;
|
|
179
|
+
}
|
|
180
|
+
if (!threw) {
|
|
181
|
+
throw new Error("Expected function to throw an error");
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
toBeInstanceOf(expected) {
|
|
185
|
+
if (!(actual instanceof expected)) {
|
|
186
|
+
throw new Error(`Expected object to be instance of ${expected?.name}`);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
toContain(expected) {
|
|
190
|
+
if (!Array.isArray(actual) && typeof actual !== "string") {
|
|
191
|
+
throw new Error("toContain works only on arrays or strings");
|
|
192
|
+
}
|
|
193
|
+
if (!actual.includes(expected)) {
|
|
194
|
+
throw new Error(`Expected ${actual} to contain ${expected}`);
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
toHaveProperty(prop) {
|
|
198
|
+
if (actual == null || !(prop in actual)) {
|
|
199
|
+
throw new Error(`Expected object to have property "${prop}"`);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
toBeNull() {
|
|
203
|
+
if (actual !== null) {
|
|
204
|
+
throw new Error(`Expected ${actual} to be null`);
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
toBeUndefined() {
|
|
208
|
+
if (actual !== undefined) {
|
|
209
|
+
throw new Error(`Expected ${actual} to be undefined`);
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
toHaveLength(expected) {
|
|
213
|
+
if (actual == null || typeof actual.length !== "number") {
|
|
214
|
+
throw new Error("toHaveLength works only on arrays or strings");
|
|
215
|
+
}
|
|
216
|
+
if (actual.length !== expected) {
|
|
217
|
+
throw new Error(`Expected length ${expected}, got ${actual.length}`);
|
|
131
218
|
}
|
|
132
219
|
},
|
|
133
220
|
};
|
|
@@ -138,6 +225,12 @@ function expect(actual) {
|
|
|
138
225
|
if (require.main === module) {
|
|
139
226
|
const runner = new TestRunner();
|
|
140
227
|
G.__testRunner = runner;
|
|
141
|
-
runner
|
|
228
|
+
runner
|
|
229
|
+
.loadTestFiles("dist/**/*.spec.js")
|
|
230
|
+
.then(() => runner.run())
|
|
231
|
+
.catch((err) => {
|
|
232
|
+
console.error("Failed to run tests:", err);
|
|
233
|
+
process.exit(1);
|
|
234
|
+
});
|
|
142
235
|
}
|
|
143
236
|
//# sourceMappingURL=runner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuHA,4BAKC;AAED,gBAKC;AAED,gCAKC;AAED,8BAKC;AAKD,wBAyFC;AA9OD,2CAA6B;AAC7B,+BAA4B;AAY5B,MAAM,CAAC,GAAG,MAA8B,CAAC;AAiBzC;;4DAE4D;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GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;SACxB,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -169,12 +169,14 @@ export class InitCommand {
|
|
|
169
169
|
"migrate:revert": "fragment migrate:revert",
|
|
170
170
|
},
|
|
171
171
|
dependencies: {
|
|
172
|
-
"fragment-ts": "^1.0.
|
|
172
|
+
"fragment-ts": "^1.0.19",
|
|
173
173
|
"reflect-metadata": "^0.1.13",
|
|
174
174
|
},
|
|
175
175
|
devDependencies: {
|
|
176
176
|
typescript: "^5.3.3",
|
|
177
177
|
"@types/node": "^20.10.5",
|
|
178
|
+
"ts-node": "^10.9.2",
|
|
179
|
+
"tsconfig-paths": "^4.2.0",
|
|
178
180
|
},
|
|
179
181
|
};
|
|
180
182
|
|
|
@@ -214,9 +216,7 @@ export class InitCommand {
|
|
|
214
216
|
database: process.env.DATABASE_FILE || "database.sqlite",
|
|
215
217
|
synchronize: true,
|
|
216
218
|
logging: false,
|
|
217
|
-
entities: isProd
|
|
218
|
-
? ["dist/**/*.entity.js"]
|
|
219
|
-
: ["src/**/*.entity.ts"],
|
|
219
|
+
entities: isProd ? ["dist/**/*.entity.js"] : ["src/**/*.entity.ts"],
|
|
220
220
|
migrations: isProd
|
|
221
221
|
? ["dist/migrations/**/*.js"]
|
|
222
222
|
: ["src/migrations/**/*.ts"],
|