express-generator-typescript 2.5.21 → 2.5.22
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.
|
@@ -5,46 +5,66 @@ import { argv } from 'process';
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
/******************************************************************************
|
|
8
|
-
|
|
8
|
+
Run
|
|
9
9
|
******************************************************************************/
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
jasmine.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
// Start
|
|
12
|
+
(async () => {
|
|
13
|
+
try {
|
|
14
|
+
// Init Jasmine
|
|
15
|
+
const jasmine = new Jasmine();
|
|
16
|
+
jasmine.exitOnCompletion = false;
|
|
17
|
+
// Set location of test files
|
|
18
|
+
jasmine.loadConfig({
|
|
19
|
+
random: true,
|
|
20
|
+
spec_dir: 'spec',
|
|
21
|
+
spec_files: [
|
|
22
|
+
'./tests/**/*.spec.ts',
|
|
23
|
+
],
|
|
24
|
+
stopSpecOnExpectationFailure: false,
|
|
25
|
+
});
|
|
26
|
+
// Run all or a single unit-test
|
|
27
|
+
let doneInfo: jasmine.JasmineDoneInfo;
|
|
28
|
+
if (!!argv[2]) {
|
|
29
|
+
const files = await findFile(argv[2]);
|
|
30
|
+
if (files.length === 1) {
|
|
31
|
+
doneInfo = await jasmine.execute([files[0]]);
|
|
32
|
+
} else {
|
|
33
|
+
return logger.err('Test file not found!');
|
|
34
|
+
}
|
|
32
35
|
} else {
|
|
33
|
-
|
|
36
|
+
doneInfo = await jasmine.execute();
|
|
34
37
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
execResp = jasmine.execute();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Wait for tests to finish
|
|
41
|
-
(async () => {
|
|
42
|
-
if (!!execResp) {
|
|
43
|
-
const info = await execResp;
|
|
44
|
-
if (info.overallStatus === 'passed') {
|
|
38
|
+
// Wait for tests to finish
|
|
39
|
+
if (doneInfo?.overallStatus === 'passed') {
|
|
45
40
|
logger.info('All tests have passed :)');
|
|
41
|
+
} else if (doneInfo?.overallStatus === 'incomplete') {
|
|
42
|
+
logger.warn('Some tests did not complete or were skipped');
|
|
46
43
|
} else {
|
|
47
44
|
logger.err('At least one test has failed :(');
|
|
48
45
|
}
|
|
46
|
+
} catch (err: unknown) {
|
|
47
|
+
return logger.err(err);
|
|
49
48
|
}
|
|
50
49
|
})();
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
/******************************************************************************
|
|
53
|
+
Functions
|
|
54
|
+
******************************************************************************/
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Wrap find file in a promise.
|
|
58
|
+
*/
|
|
59
|
+
function findFile(testFile: string): Promise<string[]> {
|
|
60
|
+
return new Promise((res, rej) => {
|
|
61
|
+
return find.file(testFile + '.spec.ts', './spec', (files: string[]) => {
|
|
62
|
+
if (files.length > 0) {
|
|
63
|
+
return res(files);
|
|
64
|
+
} else {
|
|
65
|
+
const err = new Error('Test file not found!');
|
|
66
|
+
return rej(err);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"users":[{"id":
|
|
1
|
+
{"users":[{"id":842773089876,"name":"Bill","created":"2025-03-12T20:02:55.286Z","email":"sean.maxwell@gmail.com"},{"id":941309339231,"name":"John Smith","created":"2025-03-12T20:02:55.286Z","email":"john.smith@gmail.com"},{"id":757043111392,"name":"Gordan Freeman","created":"2025-03-12T20:02:55.286Z","email":"gordan.freeman@gmail.com"}]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-generator-typescript",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.22",
|
|
4
4
|
"description": "Generate new Express applications similar to express-generate which but sets it up to use TypeScript instead",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"express-generator-typescript": "node bin/cli.js",
|