@tramvai/test-integration 1.96.0 → 1.97.0
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/lib/app/utils.d.ts +2 -0
- package/lib/index.es.js +7 -2
- package/lib/index.js +7 -1
- package/package.json +3 -3
package/lib/app/utils.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { PromiseType } from 'utility-types';
|
|
2
2
|
import type { start } from '@tramvai/cli';
|
|
3
|
+
import type { StartCliOptions } from './startCli';
|
|
3
4
|
declare type CliResult = PromiseType<ReturnType<typeof start>>;
|
|
4
5
|
export declare const getServerUrl: ({ server }: CliResult) => string;
|
|
5
6
|
export declare const getStaticUrl: ({ staticServer }: CliResult) => string;
|
|
7
|
+
export declare const getUtilityServerUrl: (env: StartCliOptions['env'], { server }: CliResult) => string;
|
|
6
8
|
export {};
|
package/lib/index.es.js
CHANGED
|
@@ -12,6 +12,10 @@ const getStaticUrl = ({ staticServer }) => {
|
|
|
12
12
|
const { port } = staticServer === null || staticServer === void 0 ? void 0 : staticServer.address();
|
|
13
13
|
return `http://localhost:${port}`;
|
|
14
14
|
};
|
|
15
|
+
const getUtilityServerUrl = (env, { server }) => {
|
|
16
|
+
const { port } = server === null || server === void 0 ? void 0 : server.address();
|
|
17
|
+
return `http://localhost:${(env === null || env === void 0 ? void 0 : env.UTILITY_SERVER_PORT) || port}`;
|
|
18
|
+
};
|
|
15
19
|
|
|
16
20
|
const wrapPapi = ({ serverUrl, appName }) => {
|
|
17
21
|
const publicPapi = supertest(`${serverUrl}/${appName}/papi/`);
|
|
@@ -83,10 +87,11 @@ const startCli = async (targetOrConfig, { enableRebuild = false, env, logger = c
|
|
|
83
87
|
});
|
|
84
88
|
const serverUrl = getServerUrl(cliResult);
|
|
85
89
|
const staticUrl = getStaticUrl(cliResult);
|
|
90
|
+
const utilityServerUrl = getUtilityServerUrl(env, cliResult);
|
|
86
91
|
const appName = typeof targetOrConfig === 'string' ? targetOrConfig : targetOrConfig.name;
|
|
87
92
|
try {
|
|
88
93
|
await waitOn({
|
|
89
|
-
resources: [`${
|
|
94
|
+
resources: [`${utilityServerUrl}/readyz`],
|
|
90
95
|
});
|
|
91
96
|
}
|
|
92
97
|
catch (e) {
|
|
@@ -117,4 +122,4 @@ const sleep = (ms) => {
|
|
|
117
122
|
return new Promise((resolve) => setTimeout(resolve, ms).unref());
|
|
118
123
|
};
|
|
119
124
|
|
|
120
|
-
export { getServerUrl, getStaticUrl, sleep, startCli };
|
|
125
|
+
export { getServerUrl, getStaticUrl, getUtilityServerUrl, sleep, startCli };
|
package/lib/index.js
CHANGED
|
@@ -21,6 +21,10 @@ const getStaticUrl = ({ staticServer }) => {
|
|
|
21
21
|
const { port } = staticServer === null || staticServer === void 0 ? void 0 : staticServer.address();
|
|
22
22
|
return `http://localhost:${port}`;
|
|
23
23
|
};
|
|
24
|
+
const getUtilityServerUrl = (env, { server }) => {
|
|
25
|
+
const { port } = server === null || server === void 0 ? void 0 : server.address();
|
|
26
|
+
return `http://localhost:${(env === null || env === void 0 ? void 0 : env.UTILITY_SERVER_PORT) || port}`;
|
|
27
|
+
};
|
|
24
28
|
|
|
25
29
|
const wrapPapi = ({ serverUrl, appName }) => {
|
|
26
30
|
const publicPapi = supertest__default["default"](`${serverUrl}/${appName}/papi/`);
|
|
@@ -92,10 +96,11 @@ const startCli = async (targetOrConfig, { enableRebuild = false, env, logger = c
|
|
|
92
96
|
});
|
|
93
97
|
const serverUrl = getServerUrl(cliResult);
|
|
94
98
|
const staticUrl = getStaticUrl(cliResult);
|
|
99
|
+
const utilityServerUrl = getUtilityServerUrl(env, cliResult);
|
|
95
100
|
const appName = typeof targetOrConfig === 'string' ? targetOrConfig : targetOrConfig.name;
|
|
96
101
|
try {
|
|
97
102
|
await waitOn__default["default"]({
|
|
98
|
-
resources: [`${
|
|
103
|
+
resources: [`${utilityServerUrl}/readyz`],
|
|
99
104
|
});
|
|
100
105
|
}
|
|
101
106
|
catch (e) {
|
|
@@ -128,5 +133,6 @@ const sleep = (ms) => {
|
|
|
128
133
|
|
|
129
134
|
exports.getServerUrl = getServerUrl;
|
|
130
135
|
exports.getStaticUrl = getStaticUrl;
|
|
136
|
+
exports.getUtilityServerUrl = getUtilityServerUrl;
|
|
131
137
|
exports.sleep = sleep;
|
|
132
138
|
exports.startCli = startCli;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/test-integration",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.97.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@tinkoff/mocker": "1.5.6",
|
|
25
|
-
"@tramvai/test-helpers": "1.
|
|
25
|
+
"@tramvai/test-helpers": "1.97.0",
|
|
26
26
|
"@types/supertest": "^2.0.11",
|
|
27
27
|
"supertest": "^6.1.3",
|
|
28
28
|
"utility-types": "^3.10.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@tinkoff/utils": "^2.1.2",
|
|
33
|
-
"@tramvai/cli": "1.
|
|
33
|
+
"@tramvai/cli": "1.97.0",
|
|
34
34
|
"tslib": "^2.0.3"
|
|
35
35
|
},
|
|
36
36
|
"license": "Apache-2.0",
|