@tramvai/test-integration 2.70.0 → 2.72.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.
@@ -0,0 +1,29 @@
1
+ const MOCKER_API_PATH = 'mocker-api';
2
+ const wrapMocker = ({ papi, }) => {
3
+ return {
4
+ addMocks(api, mocks) {
5
+ return papi
6
+ .publicPapi(`${MOCKER_API_PATH}/mocks`, {
7
+ method: 'post',
8
+ body: {
9
+ api,
10
+ mocks,
11
+ },
12
+ })
13
+ .expect(200);
14
+ },
15
+ removeMocks(api, mocks) {
16
+ return papi
17
+ .publicPapi(`${MOCKER_API_PATH}/mocks`, {
18
+ method: 'delete',
19
+ body: {
20
+ api,
21
+ mocks,
22
+ },
23
+ })
24
+ .expect(200);
25
+ },
26
+ };
27
+ };
28
+
29
+ export { wrapMocker };
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const MOCKER_API_PATH = 'mocker-api';
6
+ const wrapMocker = ({ papi, }) => {
7
+ return {
8
+ addMocks(api, mocks) {
9
+ return papi
10
+ .publicPapi(`${MOCKER_API_PATH}/mocks`, {
11
+ method: 'post',
12
+ body: {
13
+ api,
14
+ mocks,
15
+ },
16
+ })
17
+ .expect(200);
18
+ },
19
+ removeMocks(api, mocks) {
20
+ return papi
21
+ .publicPapi(`${MOCKER_API_PATH}/mocks`, {
22
+ method: 'delete',
23
+ body: {
24
+ api,
25
+ mocks,
26
+ },
27
+ })
28
+ .expect(200);
29
+ },
30
+ };
31
+ };
32
+
33
+ exports.wrapMocker = wrapMocker;
@@ -0,0 +1,18 @@
1
+ import { requestFactory } from '@tramvai/test-helpers';
2
+
3
+ const wrapPapi = ({ serverUrl, appName }) => {
4
+ const publicPapi = requestFactory(`${serverUrl}/${appName}/papi/`);
5
+ const privatePapi = requestFactory(`${serverUrl}/${appName}/private/papi/`);
6
+ return {
7
+ publicPapi,
8
+ privatePapi,
9
+ clearCache: () => {
10
+ return privatePapi(`clear-cache`, { method: 'post' }).expect(404).expect('X-Status', 'done');
11
+ },
12
+ bundleInfo: () => {
13
+ return publicPapi('bundleInfo').expect(200);
14
+ },
15
+ };
16
+ };
17
+
18
+ export { wrapPapi };
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var testHelpers = require('@tramvai/test-helpers');
6
+
7
+ const wrapPapi = ({ serverUrl, appName }) => {
8
+ const publicPapi = testHelpers.requestFactory(`${serverUrl}/${appName}/papi/`);
9
+ const privatePapi = testHelpers.requestFactory(`${serverUrl}/${appName}/private/papi/`);
10
+ return {
11
+ publicPapi,
12
+ privatePapi,
13
+ clearCache: () => {
14
+ return privatePapi(`clear-cache`, { method: 'post' }).expect(404).expect('X-Status', 'done');
15
+ },
16
+ bundleInfo: () => {
17
+ return publicPapi('bundleInfo').expect(200);
18
+ },
19
+ };
20
+ };
21
+
22
+ exports.wrapPapi = wrapPapi;
@@ -0,0 +1,92 @@
1
+ import mergeDeep from '@tinkoff/utils/object/mergeDeep';
2
+ import { Writable } from 'stream';
3
+ import envCi from 'env-ci';
4
+ import { start } from '@tramvai/cli';
5
+ import waitOn from 'wait-on';
6
+ import { requestFactory, renderFactory } from '@tramvai/test-helpers';
7
+ import { getServerUrl, getStaticUrl, getUtilityServerUrl } from './utils.es.js';
8
+ export { getServerUrl, getStaticUrl, getUtilityServerUrl } from './utils.es.js';
9
+ import { wrapPapi } from './papi.es.js';
10
+ import { wrapMocker } from './mocker.es.js';
11
+
12
+ const ciInfo = envCi();
13
+ const startCli = async (targetOrConfig, { enableRebuild = false, env, logger = console, ...cliOptions } = {}) => {
14
+ const stdout = new Writable({
15
+ write(chunk, encoding, callback) {
16
+ logger.log(`[@tramvai/cli] log:`, chunk.toString());
17
+ callback();
18
+ },
19
+ });
20
+ const stderr = new Writable({
21
+ write(chunk, encoding, callback) {
22
+ logger.error(`[@tramvai/cli] error:`, chunk.toString());
23
+ callback();
24
+ },
25
+ });
26
+ const cliResult = await start({
27
+ stdout,
28
+ stderr,
29
+ noClientRebuild: !enableRebuild,
30
+ noServerRebuild: !enableRebuild,
31
+ // build cache made tests unstable in CI, because of cache writing process are async,
32
+ // and there is no way to wait this process (`idleTimeoutForInitialStore: 0` helps sometimes, but no guarantees)
33
+ fileCache: !ciInfo.isCi,
34
+ ...(typeof targetOrConfig === 'string'
35
+ ? { target: targetOrConfig }
36
+ : {
37
+ config: mergeDeep({
38
+ // disable hot-refresh that may break checks for full page load because of never-ending request
39
+ hotRefresh: { enabled: false },
40
+ }, targetOrConfig),
41
+ }),
42
+ env: {
43
+ ...env,
44
+ MOCKER_ENABLED: 'true',
45
+ },
46
+ port: 0,
47
+ staticPort: 0,
48
+ ...cliOptions,
49
+ });
50
+ const serverUrl = getServerUrl(cliResult);
51
+ const staticUrl = getStaticUrl(cliResult);
52
+ // @FIXME: the utility port might be defined on the provider level and we don't have access to it
53
+ // in this case. So the value might be inconsistent with actual utility server (actually, already inconsistent for tincoin)
54
+ const utilityServerUrl = getUtilityServerUrl(env, cliResult);
55
+ const appName = typeof targetOrConfig === 'string' ? targetOrConfig : targetOrConfig.name;
56
+ try {
57
+ await waitOn({
58
+ resources: [`${utilityServerUrl}/readyz`],
59
+ });
60
+ }
61
+ catch (e) {
62
+ logger.error('[@tramvai/cli] /readyz wait failed:', e);
63
+ throw e;
64
+ }
65
+ const request = requestFactory(serverUrl);
66
+ const render = renderFactory(request, {
67
+ replaceDynamicStrings: {
68
+ // eslint-disable-next-line no-template-curly-in-string
69
+ [serverUrl]: '${SERVER_URL}',
70
+ // eslint-disable-next-line no-template-curly-in-string
71
+ [staticUrl]: '${STATIC_URL}',
72
+ },
73
+ });
74
+ const papi = wrapPapi({
75
+ serverUrl,
76
+ appName,
77
+ });
78
+ const mocker = wrapMocker({ papi });
79
+ return {
80
+ ...cliResult,
81
+ serverUrl,
82
+ staticUrl,
83
+ stdout,
84
+ stderr,
85
+ request,
86
+ render,
87
+ papi,
88
+ mocker,
89
+ };
90
+ };
91
+
92
+ export { startCli };
@@ -0,0 +1,104 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var mergeDeep = require('@tinkoff/utils/object/mergeDeep');
6
+ var stream = require('stream');
7
+ var envCi = require('env-ci');
8
+ var cli = require('@tramvai/cli');
9
+ var waitOn = require('wait-on');
10
+ var testHelpers = require('@tramvai/test-helpers');
11
+ var utils = require('./utils.js');
12
+ var papi = require('./papi.js');
13
+ var mocker = require('./mocker.js');
14
+
15
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
+
17
+ var mergeDeep__default = /*#__PURE__*/_interopDefaultLegacy(mergeDeep);
18
+ var envCi__default = /*#__PURE__*/_interopDefaultLegacy(envCi);
19
+ var waitOn__default = /*#__PURE__*/_interopDefaultLegacy(waitOn);
20
+
21
+ const ciInfo = envCi__default["default"]();
22
+ const startCli = async (targetOrConfig, { enableRebuild = false, env, logger = console, ...cliOptions } = {}) => {
23
+ const stdout = new stream.Writable({
24
+ write(chunk, encoding, callback) {
25
+ logger.log(`[@tramvai/cli] log:`, chunk.toString());
26
+ callback();
27
+ },
28
+ });
29
+ const stderr = new stream.Writable({
30
+ write(chunk, encoding, callback) {
31
+ logger.error(`[@tramvai/cli] error:`, chunk.toString());
32
+ callback();
33
+ },
34
+ });
35
+ const cliResult = await cli.start({
36
+ stdout,
37
+ stderr,
38
+ noClientRebuild: !enableRebuild,
39
+ noServerRebuild: !enableRebuild,
40
+ // build cache made tests unstable in CI, because of cache writing process are async,
41
+ // and there is no way to wait this process (`idleTimeoutForInitialStore: 0` helps sometimes, but no guarantees)
42
+ fileCache: !ciInfo.isCi,
43
+ ...(typeof targetOrConfig === 'string'
44
+ ? { target: targetOrConfig }
45
+ : {
46
+ config: mergeDeep__default["default"]({
47
+ // disable hot-refresh that may break checks for full page load because of never-ending request
48
+ hotRefresh: { enabled: false },
49
+ }, targetOrConfig),
50
+ }),
51
+ env: {
52
+ ...env,
53
+ MOCKER_ENABLED: 'true',
54
+ },
55
+ port: 0,
56
+ staticPort: 0,
57
+ ...cliOptions,
58
+ });
59
+ const serverUrl = utils.getServerUrl(cliResult);
60
+ const staticUrl = utils.getStaticUrl(cliResult);
61
+ // @FIXME: the utility port might be defined on the provider level and we don't have access to it
62
+ // in this case. So the value might be inconsistent with actual utility server (actually, already inconsistent for tincoin)
63
+ const utilityServerUrl = utils.getUtilityServerUrl(env, cliResult);
64
+ const appName = typeof targetOrConfig === 'string' ? targetOrConfig : targetOrConfig.name;
65
+ try {
66
+ await waitOn__default["default"]({
67
+ resources: [`${utilityServerUrl}/readyz`],
68
+ });
69
+ }
70
+ catch (e) {
71
+ logger.error('[@tramvai/cli] /readyz wait failed:', e);
72
+ throw e;
73
+ }
74
+ const request = testHelpers.requestFactory(serverUrl);
75
+ const render = testHelpers.renderFactory(request, {
76
+ replaceDynamicStrings: {
77
+ // eslint-disable-next-line no-template-curly-in-string
78
+ [serverUrl]: '${SERVER_URL}',
79
+ // eslint-disable-next-line no-template-curly-in-string
80
+ [staticUrl]: '${STATIC_URL}',
81
+ },
82
+ });
83
+ const papi$1 = papi.wrapPapi({
84
+ serverUrl,
85
+ appName,
86
+ });
87
+ const mocker$1 = mocker.wrapMocker({ papi: papi$1 });
88
+ return {
89
+ ...cliResult,
90
+ serverUrl,
91
+ staticUrl,
92
+ stdout,
93
+ stderr,
94
+ request,
95
+ render,
96
+ papi: papi$1,
97
+ mocker: mocker$1,
98
+ };
99
+ };
100
+
101
+ exports.getServerUrl = utils.getServerUrl;
102
+ exports.getStaticUrl = utils.getStaticUrl;
103
+ exports.getUtilityServerUrl = utils.getUtilityServerUrl;
104
+ exports.startCli = startCli;
@@ -0,0 +1,14 @@
1
+ const getServerUrl = ({ server }) => {
2
+ const { port } = server === null || server === void 0 ? void 0 : server.address();
3
+ return `http://localhost:${port}`;
4
+ };
5
+ const getStaticUrl = ({ staticServer }) => {
6
+ const { port } = staticServer === null || staticServer === void 0 ? void 0 : staticServer.address();
7
+ return `http://localhost:${port}`;
8
+ };
9
+ const getUtilityServerUrl = (env, { server }) => {
10
+ const { port } = server === null || server === void 0 ? void 0 : server.address();
11
+ return `http://localhost:${(env === null || env === void 0 ? void 0 : env.UTILITY_SERVER_PORT) || port}`;
12
+ };
13
+
14
+ export { getServerUrl, getStaticUrl, getUtilityServerUrl };
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const getServerUrl = ({ server }) => {
6
+ const { port } = server === null || server === void 0 ? void 0 : server.address();
7
+ return `http://localhost:${port}`;
8
+ };
9
+ const getStaticUrl = ({ staticServer }) => {
10
+ const { port } = staticServer === null || staticServer === void 0 ? void 0 : staticServer.address();
11
+ return `http://localhost:${port}`;
12
+ };
13
+ const getUtilityServerUrl = (env, { server }) => {
14
+ const { port } = server === null || server === void 0 ? void 0 : server.address();
15
+ return `http://localhost:${(env === null || env === void 0 ? void 0 : env.UTILITY_SERVER_PORT) || port}`;
16
+ };
17
+
18
+ exports.getServerUrl = getServerUrl;
19
+ exports.getStaticUrl = getStaticUrl;
20
+ exports.getUtilityServerUrl = getUtilityServerUrl;
@@ -0,0 +1,5 @@
1
+ const sleep = (ms) => {
2
+ return new Promise((resolve) => setTimeout(resolve, ms).unref());
3
+ };
4
+
5
+ export { sleep };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const sleep = (ms) => {
6
+ return new Promise((resolve) => setTimeout(resolve, ms).unref());
7
+ };
8
+
9
+ exports.sleep = sleep;
package/lib/index.es.js CHANGED
@@ -1,148 +1,3 @@
1
- import mergeDeep from '@tinkoff/utils/object/mergeDeep';
2
- import { Writable } from 'stream';
3
- import envCi from 'env-ci';
4
- import { start } from '@tramvai/cli';
5
- import waitOn from 'wait-on';
6
- import { requestFactory, renderFactory } from '@tramvai/test-helpers';
7
-
8
- const getServerUrl = ({ server }) => {
9
- const { port } = server === null || server === void 0 ? void 0 : server.address();
10
- return `http://localhost:${port}`;
11
- };
12
- const getStaticUrl = ({ staticServer }) => {
13
- const { port } = staticServer === null || staticServer === void 0 ? void 0 : staticServer.address();
14
- return `http://localhost:${port}`;
15
- };
16
- const getUtilityServerUrl = (env, { server }) => {
17
- const { port } = server === null || server === void 0 ? void 0 : server.address();
18
- return `http://localhost:${(env === null || env === void 0 ? void 0 : env.UTILITY_SERVER_PORT) || port}`;
19
- };
20
-
21
- const wrapPapi = ({ serverUrl, appName }) => {
22
- const publicPapi = requestFactory(`${serverUrl}/${appName}/papi/`);
23
- const privatePapi = requestFactory(`${serverUrl}/${appName}/private/papi/`);
24
- return {
25
- publicPapi,
26
- privatePapi,
27
- clearCache: () => {
28
- return privatePapi(`clear-cache`, { method: 'post' }).expect(404).expect('X-Status', 'done');
29
- },
30
- bundleInfo: () => {
31
- return publicPapi('bundleInfo').expect(200);
32
- },
33
- };
34
- };
35
-
36
- const MOCKER_API_PATH = 'mocker-api';
37
- const wrapMocker = ({ papi, }) => {
38
- return {
39
- addMocks(api, mocks) {
40
- return papi
41
- .publicPapi(`${MOCKER_API_PATH}/mocks`, {
42
- method: 'post',
43
- body: {
44
- api,
45
- mocks,
46
- },
47
- })
48
- .expect(200);
49
- },
50
- removeMocks(api, mocks) {
51
- return papi
52
- .publicPapi(`${MOCKER_API_PATH}/mocks`, {
53
- method: 'delete',
54
- body: {
55
- api,
56
- mocks,
57
- },
58
- })
59
- .expect(200);
60
- },
61
- };
62
- };
63
-
64
- const ciInfo = envCi();
65
- const startCli = async (targetOrConfig, { enableRebuild = false, env, logger = console, ...cliOptions } = {}) => {
66
- const stdout = new Writable({
67
- write(chunk, encoding, callback) {
68
- logger.log(`[@tramvai/cli] log:`, chunk.toString());
69
- callback();
70
- },
71
- });
72
- const stderr = new Writable({
73
- write(chunk, encoding, callback) {
74
- logger.error(`[@tramvai/cli] error:`, chunk.toString());
75
- callback();
76
- },
77
- });
78
- const cliResult = await start({
79
- stdout,
80
- stderr,
81
- noClientRebuild: !enableRebuild,
82
- noServerRebuild: !enableRebuild,
83
- // build cache made tests unstable in CI, because of cache writing process are async,
84
- // and there is no way to wait this process (`idleTimeoutForInitialStore: 0` helps sometimes, but no guarantees)
85
- fileCache: !ciInfo.isCi,
86
- ...(typeof targetOrConfig === 'string'
87
- ? { target: targetOrConfig }
88
- : {
89
- config: mergeDeep({
90
- // disable hot-refresh that may break checks for full page load because of never-ending request
91
- hotRefresh: { enabled: false },
92
- }, targetOrConfig),
93
- }),
94
- env: {
95
- ...env,
96
- MOCKER_ENABLED: 'true',
97
- },
98
- port: 0,
99
- staticPort: 0,
100
- ...cliOptions,
101
- });
102
- const serverUrl = getServerUrl(cliResult);
103
- const staticUrl = getStaticUrl(cliResult);
104
- // @FIXME: the utility port might be defined on the provider level and we don't have access to it
105
- // in this case. So the value might be inconsistent with actual utility server (actually, already inconsistent for tincoin)
106
- const utilityServerUrl = getUtilityServerUrl(env, cliResult);
107
- const appName = typeof targetOrConfig === 'string' ? targetOrConfig : targetOrConfig.name;
108
- try {
109
- await waitOn({
110
- resources: [`${utilityServerUrl}/readyz`],
111
- });
112
- }
113
- catch (e) {
114
- logger.error('[@tramvai/cli] /readyz wait failed:', e);
115
- throw e;
116
- }
117
- const request = requestFactory(serverUrl);
118
- const render = renderFactory(request, {
119
- replaceDynamicStrings: {
120
- // eslint-disable-next-line no-template-curly-in-string
121
- [serverUrl]: '${SERVER_URL}',
122
- // eslint-disable-next-line no-template-curly-in-string
123
- [staticUrl]: '${STATIC_URL}',
124
- },
125
- });
126
- const papi = wrapPapi({
127
- serverUrl,
128
- appName,
129
- });
130
- const mocker = wrapMocker({ papi });
131
- return {
132
- ...cliResult,
133
- serverUrl,
134
- staticUrl,
135
- stdout,
136
- stderr,
137
- request,
138
- render,
139
- papi,
140
- mocker,
141
- };
142
- };
143
-
144
- const sleep = (ms) => {
145
- return new Promise((resolve) => setTimeout(resolve, ms).unref());
146
- };
147
-
148
- export { getServerUrl, getStaticUrl, getUtilityServerUrl, sleep, startCli };
1
+ export { startCli } from './app/startCli.es.js';
2
+ export { sleep } from './helpers/sleep.es.js';
3
+ export { getServerUrl, getStaticUrl, getUtilityServerUrl } from './app/utils.es.js';
package/lib/index.js CHANGED
@@ -2,161 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var mergeDeep = require('@tinkoff/utils/object/mergeDeep');
6
- var stream = require('stream');
7
- var envCi = require('env-ci');
8
- var cli = require('@tramvai/cli');
9
- var waitOn = require('wait-on');
10
- var testHelpers = require('@tramvai/test-helpers');
5
+ var startCli = require('./app/startCli.js');
6
+ var sleep = require('./helpers/sleep.js');
7
+ var utils = require('./app/utils.js');
11
8
 
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
9
 
14
- var mergeDeep__default = /*#__PURE__*/_interopDefaultLegacy(mergeDeep);
15
- var envCi__default = /*#__PURE__*/_interopDefaultLegacy(envCi);
16
- var waitOn__default = /*#__PURE__*/_interopDefaultLegacy(waitOn);
17
10
 
18
- const getServerUrl = ({ server }) => {
19
- const { port } = server === null || server === void 0 ? void 0 : server.address();
20
- return `http://localhost:${port}`;
21
- };
22
- const getStaticUrl = ({ staticServer }) => {
23
- const { port } = staticServer === null || staticServer === void 0 ? void 0 : staticServer.address();
24
- return `http://localhost:${port}`;
25
- };
26
- const getUtilityServerUrl = (env, { server }) => {
27
- const { port } = server === null || server === void 0 ? void 0 : server.address();
28
- return `http://localhost:${(env === null || env === void 0 ? void 0 : env.UTILITY_SERVER_PORT) || port}`;
29
- };
30
-
31
- const wrapPapi = ({ serverUrl, appName }) => {
32
- const publicPapi = testHelpers.requestFactory(`${serverUrl}/${appName}/papi/`);
33
- const privatePapi = testHelpers.requestFactory(`${serverUrl}/${appName}/private/papi/`);
34
- return {
35
- publicPapi,
36
- privatePapi,
37
- clearCache: () => {
38
- return privatePapi(`clear-cache`, { method: 'post' }).expect(404).expect('X-Status', 'done');
39
- },
40
- bundleInfo: () => {
41
- return publicPapi('bundleInfo').expect(200);
42
- },
43
- };
44
- };
45
-
46
- const MOCKER_API_PATH = 'mocker-api';
47
- const wrapMocker = ({ papi, }) => {
48
- return {
49
- addMocks(api, mocks) {
50
- return papi
51
- .publicPapi(`${MOCKER_API_PATH}/mocks`, {
52
- method: 'post',
53
- body: {
54
- api,
55
- mocks,
56
- },
57
- })
58
- .expect(200);
59
- },
60
- removeMocks(api, mocks) {
61
- return papi
62
- .publicPapi(`${MOCKER_API_PATH}/mocks`, {
63
- method: 'delete',
64
- body: {
65
- api,
66
- mocks,
67
- },
68
- })
69
- .expect(200);
70
- },
71
- };
72
- };
73
-
74
- const ciInfo = envCi__default["default"]();
75
- const startCli = async (targetOrConfig, { enableRebuild = false, env, logger = console, ...cliOptions } = {}) => {
76
- const stdout = new stream.Writable({
77
- write(chunk, encoding, callback) {
78
- logger.log(`[@tramvai/cli] log:`, chunk.toString());
79
- callback();
80
- },
81
- });
82
- const stderr = new stream.Writable({
83
- write(chunk, encoding, callback) {
84
- logger.error(`[@tramvai/cli] error:`, chunk.toString());
85
- callback();
86
- },
87
- });
88
- const cliResult = await cli.start({
89
- stdout,
90
- stderr,
91
- noClientRebuild: !enableRebuild,
92
- noServerRebuild: !enableRebuild,
93
- // build cache made tests unstable in CI, because of cache writing process are async,
94
- // and there is no way to wait this process (`idleTimeoutForInitialStore: 0` helps sometimes, but no guarantees)
95
- fileCache: !ciInfo.isCi,
96
- ...(typeof targetOrConfig === 'string'
97
- ? { target: targetOrConfig }
98
- : {
99
- config: mergeDeep__default["default"]({
100
- // disable hot-refresh that may break checks for full page load because of never-ending request
101
- hotRefresh: { enabled: false },
102
- }, targetOrConfig),
103
- }),
104
- env: {
105
- ...env,
106
- MOCKER_ENABLED: 'true',
107
- },
108
- port: 0,
109
- staticPort: 0,
110
- ...cliOptions,
111
- });
112
- const serverUrl = getServerUrl(cliResult);
113
- const staticUrl = getStaticUrl(cliResult);
114
- // @FIXME: the utility port might be defined on the provider level and we don't have access to it
115
- // in this case. So the value might be inconsistent with actual utility server (actually, already inconsistent for tincoin)
116
- const utilityServerUrl = getUtilityServerUrl(env, cliResult);
117
- const appName = typeof targetOrConfig === 'string' ? targetOrConfig : targetOrConfig.name;
118
- try {
119
- await waitOn__default["default"]({
120
- resources: [`${utilityServerUrl}/readyz`],
121
- });
122
- }
123
- catch (e) {
124
- logger.error('[@tramvai/cli] /readyz wait failed:', e);
125
- throw e;
126
- }
127
- const request = testHelpers.requestFactory(serverUrl);
128
- const render = testHelpers.renderFactory(request, {
129
- replaceDynamicStrings: {
130
- // eslint-disable-next-line no-template-curly-in-string
131
- [serverUrl]: '${SERVER_URL}',
132
- // eslint-disable-next-line no-template-curly-in-string
133
- [staticUrl]: '${STATIC_URL}',
134
- },
135
- });
136
- const papi = wrapPapi({
137
- serverUrl,
138
- appName,
139
- });
140
- const mocker = wrapMocker({ papi });
141
- return {
142
- ...cliResult,
143
- serverUrl,
144
- staticUrl,
145
- stdout,
146
- stderr,
147
- request,
148
- render,
149
- papi,
150
- mocker,
151
- };
152
- };
153
-
154
- const sleep = (ms) => {
155
- return new Promise((resolve) => setTimeout(resolve, ms).unref());
156
- };
157
-
158
- exports.getServerUrl = getServerUrl;
159
- exports.getStaticUrl = getStaticUrl;
160
- exports.getUtilityServerUrl = getUtilityServerUrl;
161
- exports.sleep = sleep;
162
- exports.startCli = startCli;
11
+ exports.startCli = startCli.startCli;
12
+ exports.sleep = sleep.sleep;
13
+ exports.getServerUrl = utils.getServerUrl;
14
+ exports.getStaticUrl = utils.getStaticUrl;
15
+ exports.getUtilityServerUrl = utils.getUtilityServerUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/test-integration",
3
- "version": "2.70.0",
3
+ "version": "2.72.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -13,23 +13,22 @@
13
13
  "url": "git@github.com:Tinkoff/tramvai.git"
14
14
  },
15
15
  "scripts": {
16
- "build": "tramvai-build --for-publish",
17
- "watch": "tsc -w",
18
- "build-for-publish": "true"
16
+ "build": "tramvai-build --forPublish --preserveModules",
17
+ "watch": "tsc -w"
19
18
  },
20
19
  "devDependencies": {
21
20
  "@types/wait-on": "^5.2.0"
22
21
  },
23
22
  "dependencies": {
24
- "@tinkoff/mocker": "2.1.3",
25
- "@tramvai/test-helpers": "2.70.0",
23
+ "@tinkoff/mocker": "2.1.4",
24
+ "@tramvai/test-helpers": "2.72.0",
26
25
  "env-ci": "^5.0.2",
27
26
  "utility-types": "^3.10.0",
28
27
  "wait-on": "^5.3.0"
29
28
  },
30
29
  "peerDependencies": {
31
30
  "@tinkoff/utils": "^2.1.2",
32
- "@tramvai/cli": "2.70.0",
31
+ "@tramvai/cli": "2.72.0",
33
32
  "tslib": "^2.4.0"
34
33
  },
35
34
  "license": "Apache-2.0",