@adobe/aio-cli-plugin-api-mesh 5.2.2 → 5.2.3-alpha.1
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/oclif.manifest.json +1 -1
- package/package.json +8 -3
- package/src/commands/api-mesh/__tests__/create.test.js +18 -6
- package/src/commands/api-mesh/__tests__/run.test.js +191 -65
- package/src/commands/api-mesh/__tests__/update.test.js +4 -2
- package/src/commands/api-mesh/create.js +2 -3
- package/src/commands/api-mesh/run.js +207 -161
- package/src/commands/api-mesh/update.js +2 -3
- package/src/commands/{PLUGINNAME/__tests__/index.test.js → api-mesh.js} +13 -15
- package/src/helpers.js +20 -10
- package/src/lib/devConsole.js +1 -1
- package/src/meshArtifact.js +231 -0
- package/src/project.js +56 -0
- package/src/server.js +74 -32
- package/src/utils.js +10 -2
- package/src/{index.js → worker.js} +9 -7
- package/src/wranglerCli.js +54 -0
- package/wrangler.toml +13 -0
- package/src/commands/PLUGINNAME/index.js +0 -32
- package/src/wranglerServer.js +0 -80
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.2.2","commands":{"PLUGINNAME":{"id":"PLUGINNAME","description":"Your description here","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":["$ aio PLUGINNAME:some_command"],"flags":{"someflag":{"name":"someflag","type":"option","char":"f","description":"this is some flag"}},"args":[]},"api-mesh:create":{"id":"api-mesh:create","description":"Create a mesh with the given config.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"json":{"name":"json","type":"boolean","description":"Output JSON","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"secrets":{"name":"secrets","type":"option","char":"s","description":"Path to secrets file","default":false}},"args":[{"name":"file"}]},"api-mesh:delete":{"id":"api-mesh:delete","description":"Delete the config of a given mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false}},"args":[]},"api-mesh:describe":{"id":"api-mesh:describe","description":"Get details of a mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[]},"api-mesh:get":{"id":"api-mesh:get","description":"Get the config of a given mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"json":{"name":"json","type":"boolean","description":"Output JSON","allowNo":false}},"args":[{"name":"file"}]},"api-mesh:init":{"id":"api-mesh:init","description":"This command will create a workspace where you can organise your API mesh configuration and other files","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":[{"description":"API mesh workspace init","command":"aio api-mesh init commerce-mesh"},{"description":"API mesh workspace init with flags","command":"aio api-mesh init commerce-mesh --path ./mesh_projects/test_mesh --git y --packageManager yarn"}],"flags":{"path":{"name":"path","type":"option","char":"p","default":"."},"packageManager":{"name":"packageManager","type":"option","char":"m","options":["npm","yarn"]},"git":{"name":"git","type":"option","char":"g","options":["y","n"]}},"args":[{"name":"projectName","description":"Project name","required":true}]},"api-mesh:log-get-bulk":{"id":"api-mesh:log-get-bulk","description":"Download all mesh logs for a selected time period.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"startTime":{"name":"startTime","type":"option","description":"Start time for the logs in UTC"},"endTime":{"name":"endTime","type":"option","description":"End time for the logs in UTC"},"filename":{"name":"filename","type":"option","description":"Path to the output file for logs","required":true},"past":{"name":"past","type":"option","description":"Past time window in mins"},"from":{"name":"from","type":"option","description":"The from time in YYYY-MM-DD:HH:MM:SS format based on your system's time zone. It is used to fetch logs from the past and is the starting time for the past time duration."}},"args":[]},"api-mesh:log-get":{"id":"api-mesh:log-get","description":"Get the Log of a given mesh by RayId","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[{"name":"rayId","description":"Fetch a single log by rayID","required":true}]},"api-mesh:log-list":{"id":"api-mesh:log-list","description":"Get recent logs of requests made to the API Mesh.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"filename":{"name":"filename","type":"option","description":"Name of CSV file to export the recent logs to"}},"args":[]},"api-mesh:run":{"id":"api-mesh:run","description":"Run a local development server that builds and compiles a mesh locally","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"Port number for the local dev server"},"debug":{"name":"debug","type":"boolean","description":"Enable debugging mode","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"select":{"name":"select","type":"boolean","description":"Retrieve existing artifacts from the mesh","allowNo":false},"secrets":{"name":"secrets","type":"option","char":"s","description":"Path to secrets file","default":false}},"args":[{"name":"file","description":"Mesh File"}]},"api-mesh:status":{"id":"api-mesh:status","description":"Get a mesh status with a given meshid.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[]},"api-mesh:update":{"id":"api-mesh:update","description":"Update a mesh with the given config.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"secrets":{"name":"secrets","type":"option","char":"s","description":"Path to secrets file","default":false}},"args":[{"name":"file"}]},"api-mesh:cache:purge":{"id":"api-mesh:cache:purge","description":"Cache purge for a given mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"all":{"name":"all","type":"boolean","char":"a","description":"Purge all cache. CLI will purge all cache data.","required":true,"allowNo":false}},"args":[]},"api-mesh:source:discover":{"id":"api-mesh:source:discover","description":"Return the list of avaliable sources","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"confirm":{"name":"confirm","type":"boolean","char":"c","description":"Auto confirm install action prompt. CLI will not check ask user to install source.","allowNo":false}},"args":[]},"api-mesh:source:get":{"id":"api-mesh:source:get","description":"Command returns the content of a specific source.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":["$ aio api-mesh:source:get -s=<version>@<source_name>","$ aio api-mesh:source:get -s<source_name>","$ aio api-mesh:source:get -m"],"flags":{"confirm":{"name":"confirm","type":"boolean","char":"c","description":"Auto confirm print action prompt. CLI will not check ask user to print source.","allowNo":false},"source":{"name":"source","type":"option","char":"s","description":"Source name"},"multiple":{"name":"multiple","type":"boolean","char":"m","description":"Select multiple sources","allowNo":false}},"args":[]},"api-mesh:source:install":{"id":"api-mesh:source:install","description":"Command to install the source to your API mesh.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":["$ aio api-mesh:source:install <version>@<source_name>","$ aio api-mesh:source:install <source_name> -v <variable_name>=<variable_value>","$ aio api-mesh:source:install <source_name> -f <path_to_variables_file>"],"flags":{"source":{"name":"source","type":"option","char":"s","description":"Source name"},"confirm":{"name":"confirm","type":"boolean","char":"c","description":"Auto confirm override action prompt. CLI will not check ask user to override source.","allowNo":false},"variable":{"name":"variable","type":"option","char":"v","description":"Variables required for the source"},"variable-file":{"name":"variable-file","type":"option","char":"f","description":"Variables file path"},"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[{"name":"source"}]}}}
|
|
1
|
+
{"version":"5.2.3-alpha.1","commands":{"api-mesh":{"id":"api-mesh","description":"Create, run, test, and deploy API Mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{},"args":[]},"api-mesh:create":{"id":"api-mesh:create","description":"Create a mesh with the given config.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"json":{"name":"json","type":"boolean","description":"Output JSON","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"secrets":{"name":"secrets","type":"option","char":"s","description":"Path to secrets file","default":false}},"args":[{"name":"file"}]},"api-mesh:delete":{"id":"api-mesh:delete","description":"Delete the config of a given mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false}},"args":[]},"api-mesh:describe":{"id":"api-mesh:describe","description":"Get details of a mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[]},"api-mesh:get":{"id":"api-mesh:get","description":"Get the config of a given mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"json":{"name":"json","type":"boolean","description":"Output JSON","allowNo":false}},"args":[{"name":"file"}]},"api-mesh:init":{"id":"api-mesh:init","description":"This command will create a workspace where you can organise your API mesh configuration and other files","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":[{"description":"API mesh workspace init","command":"aio api-mesh init commerce-mesh"},{"description":"API mesh workspace init with flags","command":"aio api-mesh init commerce-mesh --path ./mesh_projects/test_mesh --git y --packageManager yarn"}],"flags":{"path":{"name":"path","type":"option","char":"p","default":"."},"packageManager":{"name":"packageManager","type":"option","char":"m","options":["npm","yarn"]},"git":{"name":"git","type":"option","char":"g","options":["y","n"]}},"args":[{"name":"projectName","description":"Project name","required":true}]},"api-mesh:log-get-bulk":{"id":"api-mesh:log-get-bulk","description":"Download all mesh logs for a selected time period.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"startTime":{"name":"startTime","type":"option","description":"Start time for the logs in UTC"},"endTime":{"name":"endTime","type":"option","description":"End time for the logs in UTC"},"filename":{"name":"filename","type":"option","description":"Path to the output file for logs","required":true},"past":{"name":"past","type":"option","description":"Past time window in mins"},"from":{"name":"from","type":"option","description":"The from time in YYYY-MM-DD:HH:MM:SS format based on your system's time zone. It is used to fetch logs from the past and is the starting time for the past time duration."}},"args":[]},"api-mesh:log-get":{"id":"api-mesh:log-get","description":"Get the Log of a given mesh by RayId","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[{"name":"rayId","description":"Fetch a single log by rayID","required":true}]},"api-mesh:log-list":{"id":"api-mesh:log-list","description":"Get recent logs of requests made to the API Mesh.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"filename":{"name":"filename","type":"option","description":"Name of CSV file to export the recent logs to"}},"args":[]},"api-mesh:run":{"id":"api-mesh:run","description":"Run a local development server that builds and compiles a mesh locally","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"Port number for the local dev server","default":5000},"inspectPort":{"name":"inspectPort","type":"option","char":"i","description":"Port number for the local dev server inspector","default":9229},"debug":{"name":"debug","type":"boolean","description":"Enable debugging mode","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"select":{"name":"select","type":"boolean","description":"Retrieve existing artifacts from the mesh","allowNo":false},"secrets":{"name":"secrets","type":"option","char":"s","description":"Path to secrets file","default":false}},"args":[{"name":"file","description":"Mesh File"}]},"api-mesh:status":{"id":"api-mesh:status","description":"Get a mesh status with a given meshid.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[]},"api-mesh:update":{"id":"api-mesh:update","description":"Update a mesh with the given config.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"secrets":{"name":"secrets","type":"option","char":"s","description":"Path to secrets file","default":false}},"args":[{"name":"file"}]},"api-mesh:cache:purge":{"id":"api-mesh:cache:purge","description":"Cache purge for a given mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"all":{"name":"all","type":"boolean","char":"a","description":"Purge all cache. CLI will purge all cache data.","required":true,"allowNo":false}},"args":[]},"api-mesh:source:discover":{"id":"api-mesh:source:discover","description":"Return the list of avaliable sources","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"confirm":{"name":"confirm","type":"boolean","char":"c","description":"Auto confirm install action prompt. CLI will not check ask user to install source.","allowNo":false}},"args":[]},"api-mesh:source:get":{"id":"api-mesh:source:get","description":"Command returns the content of a specific source.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":["$ aio api-mesh:source:get -s=<version>@<source_name>","$ aio api-mesh:source:get -s<source_name>","$ aio api-mesh:source:get -m"],"flags":{"confirm":{"name":"confirm","type":"boolean","char":"c","description":"Auto confirm print action prompt. CLI will not check ask user to print source.","allowNo":false},"source":{"name":"source","type":"option","char":"s","description":"Source name"},"multiple":{"name":"multiple","type":"boolean","char":"m","description":"Select multiple sources","allowNo":false}},"args":[]},"api-mesh:source:install":{"id":"api-mesh:source:install","description":"Command to install the source to your API mesh.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":["$ aio api-mesh:source:install <version>@<source_name>","$ aio api-mesh:source:install <source_name> -v <variable_name>=<variable_value>","$ aio api-mesh:source:install <source_name> -f <path_to_variables_file>"],"flags":{"source":{"name":"source","type":"option","char":"s","description":"Source name"},"confirm":{"name":"confirm","type":"boolean","char":"c","description":"Auto confirm override action prompt. CLI will not check ask user to override source.","allowNo":false},"variable":{"name":"variable","type":"option","char":"v","description":"Variables required for the source"},"variable-file":{"name":"variable-file","type":"option","char":"f","description":"Variables file path"},"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[{"name":"source"}]}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aio-cli-plugin-api-mesh",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.3-alpha.1",
|
|
4
4
|
"description": "Adobe I/O CLI plugin to develop and manage API mesh sources",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oclif-plugin"
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"/oclif.manifest.json",
|
|
24
|
+
"wrangler.toml",
|
|
24
25
|
"/src"
|
|
25
26
|
],
|
|
26
27
|
"scripts": {
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"@adobe/aio-lib-core-logging": "^3.0.0",
|
|
44
45
|
"@adobe/aio-lib-env": "^3.0.0",
|
|
45
46
|
"@adobe/aio-lib-ims": "^7.0.1",
|
|
46
|
-
"@adobe/plugin-hooks": "0.3.
|
|
47
|
+
"@adobe/plugin-hooks": "0.3.4",
|
|
47
48
|
"@adobe/plugin-on-fetch": "0.1.1",
|
|
48
49
|
"@adobe/plugin-source-headers": "^0.0.2",
|
|
49
50
|
"@envelop/disable-introspection": "^6.0.0",
|
|
@@ -99,11 +100,12 @@
|
|
|
99
100
|
"source-registry-storage-adapter": "github:devx-services/source-registry-storage-adapter#main",
|
|
100
101
|
"util": "^0.12.5",
|
|
101
102
|
"uuid": "^8.3.2",
|
|
102
|
-
"wrangler": "3.
|
|
103
|
+
"wrangler": "4.3.0",
|
|
103
104
|
"yaml": "^2.4.2"
|
|
104
105
|
},
|
|
105
106
|
"devDependencies": {
|
|
106
107
|
"@babel/eslint-parser": "^7.15.8",
|
|
108
|
+
"@cloudflare/workers-types": "^4.20250320.0",
|
|
107
109
|
"@oclif/dev-cli": "1.26.10",
|
|
108
110
|
"@oclif/plugin-help": "2.2.3",
|
|
109
111
|
"@trivago/prettier-plugin-sort-imports": "^3.1.1",
|
|
@@ -136,6 +138,9 @@
|
|
|
136
138
|
"access": "public"
|
|
137
139
|
},
|
|
138
140
|
"oclif": {
|
|
141
|
+
"topics": {
|
|
142
|
+
"api-mesh": { "description": "Create, run, test, and deploy API Mesh"}
|
|
143
|
+
},
|
|
139
144
|
"commands": "./src/commands",
|
|
140
145
|
"bin": "aio",
|
|
141
146
|
"devPlugins": [
|
|
@@ -67,7 +67,7 @@ jest.mock('../../../helpers', () => ({
|
|
|
67
67
|
initRequestId: jest.fn().mockResolvedValue({}),
|
|
68
68
|
promptConfirm: jest.fn().mockResolvedValue(true),
|
|
69
69
|
interpolateMesh: jest.fn().mockResolvedValue({}),
|
|
70
|
-
importFiles: jest.fn().mockResolvedValue(),
|
|
70
|
+
importFiles: jest.fn().mockResolvedValue({}),
|
|
71
71
|
}));
|
|
72
72
|
jest.mock('../../../lib/devConsole');
|
|
73
73
|
jest.mock('chalk', () => ({
|
|
@@ -895,7 +895,9 @@ describe('create command tests', () => {
|
|
|
895
895
|
});
|
|
896
896
|
|
|
897
897
|
importFiles.mockResolvedValueOnce({
|
|
898
|
-
|
|
898
|
+
data: {
|
|
899
|
+
meshConfig,
|
|
900
|
+
},
|
|
899
901
|
});
|
|
900
902
|
|
|
901
903
|
const output = await CreateCommand.run();
|
|
@@ -1140,7 +1142,11 @@ describe('create command tests', () => {
|
|
|
1140
1142
|
|
|
1141
1143
|
promptConfirm.mockResolvedValueOnce(false).mockResolvedValueOnce(true);
|
|
1142
1144
|
|
|
1143
|
-
importFiles.mockResolvedValueOnce(
|
|
1145
|
+
importFiles.mockResolvedValueOnce({
|
|
1146
|
+
data: {
|
|
1147
|
+
meshConfig,
|
|
1148
|
+
},
|
|
1149
|
+
});
|
|
1144
1150
|
|
|
1145
1151
|
createMesh.mockResolvedValueOnce({
|
|
1146
1152
|
mesh: {
|
|
@@ -1272,7 +1278,9 @@ describe('create command tests', () => {
|
|
|
1272
1278
|
});
|
|
1273
1279
|
|
|
1274
1280
|
importFiles.mockResolvedValueOnce({
|
|
1275
|
-
|
|
1281
|
+
data: {
|
|
1282
|
+
meshConfig,
|
|
1283
|
+
},
|
|
1276
1284
|
});
|
|
1277
1285
|
|
|
1278
1286
|
createMesh.mockResolvedValueOnce({
|
|
@@ -1400,7 +1408,9 @@ describe('create command tests', () => {
|
|
|
1400
1408
|
promptConfirm.mockResolvedValueOnce(true);
|
|
1401
1409
|
|
|
1402
1410
|
importFiles.mockResolvedValueOnce({
|
|
1403
|
-
|
|
1411
|
+
data: {
|
|
1412
|
+
meshConfig,
|
|
1413
|
+
},
|
|
1404
1414
|
});
|
|
1405
1415
|
|
|
1406
1416
|
createMesh.mockResolvedValueOnce({
|
|
@@ -1535,7 +1545,9 @@ describe('create command tests', () => {
|
|
|
1535
1545
|
});
|
|
1536
1546
|
|
|
1537
1547
|
importFiles.mockResolvedValueOnce({
|
|
1538
|
-
|
|
1548
|
+
data: {
|
|
1549
|
+
meshConfig,
|
|
1550
|
+
},
|
|
1539
1551
|
});
|
|
1540
1552
|
|
|
1541
1553
|
const output = await CreateCommand.run();
|
|
@@ -19,7 +19,7 @@ const {
|
|
|
19
19
|
initSdk,
|
|
20
20
|
writeSecretsFile,
|
|
21
21
|
} = require('../../../helpers');
|
|
22
|
-
const {
|
|
22
|
+
const { start } = require('../../../wranglerCli');
|
|
23
23
|
const { getMeshId, getMeshArtifact } = require('../../../lib/devConsole');
|
|
24
24
|
require('@adobe-apimesh/mesh-builder');
|
|
25
25
|
|
|
@@ -32,20 +32,25 @@ jest.mock('../../../helpers', () => ({
|
|
|
32
32
|
}),
|
|
33
33
|
initRequestId: jest.fn().mockResolvedValue({}),
|
|
34
34
|
interpolateMesh: jest.fn().mockResolvedValue({}),
|
|
35
|
-
importFiles: jest.fn().mockResolvedValue(),
|
|
35
|
+
importFiles: jest.fn().mockResolvedValue({}),
|
|
36
36
|
promptConfirm: jest.fn().mockResolvedValue(true),
|
|
37
37
|
setUpTenantFiles: jest.fn().mockResolvedValue(),
|
|
38
38
|
writeSecretsFile: jest.fn().mockResolvedValue(),
|
|
39
39
|
}));
|
|
40
40
|
|
|
41
|
-
jest.mock('../../../
|
|
42
|
-
|
|
41
|
+
jest.mock('../../../wranglerCli', () => ({
|
|
42
|
+
start: jest.fn().mockResolvedValue(),
|
|
43
43
|
}));
|
|
44
44
|
|
|
45
45
|
jest.mock('../../../lib/devConsole', () => ({
|
|
46
46
|
getMeshId: jest.fn().mockResolvedValue('mockMeshId'),
|
|
47
47
|
getMeshArtifact: jest.fn().mockResolvedValue(),
|
|
48
48
|
}));
|
|
49
|
+
|
|
50
|
+
jest.mock('../../../fixPlugins', () => ({
|
|
51
|
+
fixPlugins: jest.fn().mockResolvedValue({}),
|
|
52
|
+
}));
|
|
53
|
+
|
|
49
54
|
jest.mock('chalk', () => ({
|
|
50
55
|
red: jest.fn(text => text), // Return the input text without any color formatting
|
|
51
56
|
}));
|
|
@@ -75,7 +80,6 @@ const originalEnv = {
|
|
|
75
80
|
API_MESH_TIER: 'NON-TI',
|
|
76
81
|
};
|
|
77
82
|
|
|
78
|
-
const defaultPort = 5000;
|
|
79
83
|
const os = require('os');
|
|
80
84
|
|
|
81
85
|
describe('run command tests', () => {
|
|
@@ -94,10 +98,6 @@ describe('run command tests', () => {
|
|
|
94
98
|
platformSpy.mockRestore();
|
|
95
99
|
});
|
|
96
100
|
|
|
97
|
-
beforeAll(() => {
|
|
98
|
-
jest.spyOn(RunCommand.prototype, 'copyMeshContent').mockImplementation(() => {});
|
|
99
|
-
});
|
|
100
|
-
|
|
101
101
|
test('snapshot run command description', () => {
|
|
102
102
|
expect(RunCommand.description).toMatchInlineSnapshot(
|
|
103
103
|
`"Run a local development server that builds and compiles a mesh locally"`,
|
|
@@ -138,8 +138,18 @@ describe('run command tests', () => {
|
|
|
138
138
|
"parse": [Function],
|
|
139
139
|
"type": "option",
|
|
140
140
|
},
|
|
141
|
+
"inspectPort": {
|
|
142
|
+
"char": "i",
|
|
143
|
+
"default": 9229,
|
|
144
|
+
"description": "Port number for the local dev server inspector",
|
|
145
|
+
"input": [],
|
|
146
|
+
"multiple": false,
|
|
147
|
+
"parse": [Function],
|
|
148
|
+
"type": "option",
|
|
149
|
+
},
|
|
141
150
|
"port": {
|
|
142
151
|
"char": "p",
|
|
152
|
+
"default": 5000,
|
|
143
153
|
"description": "Port number for the local dev server",
|
|
144
154
|
"input": [],
|
|
145
155
|
"multiple": false,
|
|
@@ -188,15 +198,23 @@ describe('run command tests', () => {
|
|
|
188
198
|
});
|
|
189
199
|
|
|
190
200
|
test('should use the port number provided in the flags for starting the server', async () => {
|
|
191
|
-
const
|
|
201
|
+
const cliInput = {
|
|
192
202
|
args: { file: 'src/commands/__fixtures__/sample_mesh.json' },
|
|
193
|
-
flags: {
|
|
203
|
+
flags: {
|
|
204
|
+
port: 6000,
|
|
205
|
+
debug: false,
|
|
206
|
+
inspectPort: 9229,
|
|
207
|
+
},
|
|
194
208
|
};
|
|
195
|
-
|
|
196
|
-
parseSpy.mockResolvedValue(parseOutput);
|
|
209
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
197
210
|
|
|
198
211
|
await RunCommand.run();
|
|
199
|
-
expect(
|
|
212
|
+
expect(start).toHaveBeenCalledWith(
|
|
213
|
+
expect.anything(),
|
|
214
|
+
cliInput.flags.port,
|
|
215
|
+
cliInput.flags.debug,
|
|
216
|
+
cliInput.flags.inspectPort,
|
|
217
|
+
);
|
|
200
218
|
});
|
|
201
219
|
|
|
202
220
|
test('should use the port number provided in the .env file if there is no port', async () => {
|
|
@@ -205,15 +223,23 @@ describe('run command tests', () => {
|
|
|
205
223
|
PORT: 7000,
|
|
206
224
|
};
|
|
207
225
|
|
|
208
|
-
const
|
|
226
|
+
const cliInput = {
|
|
209
227
|
args: { file: 'src/commands/__fixtures__/sample_mesh.json' },
|
|
210
|
-
flags: {
|
|
228
|
+
flags: {
|
|
229
|
+
port: 5000,
|
|
230
|
+
debug: false,
|
|
231
|
+
inspectPort: 9229,
|
|
232
|
+
},
|
|
211
233
|
};
|
|
212
|
-
|
|
213
|
-
parseSpy.mockResolvedValue(parseOutput);
|
|
234
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
214
235
|
|
|
215
236
|
await RunCommand.run();
|
|
216
|
-
expect(
|
|
237
|
+
expect(start).toHaveBeenCalledWith(
|
|
238
|
+
expect.anything(),
|
|
239
|
+
process.env.PORT,
|
|
240
|
+
cliInput.flags.debug,
|
|
241
|
+
cliInput.flags.inspectPort,
|
|
242
|
+
);
|
|
217
243
|
});
|
|
218
244
|
|
|
219
245
|
test('should use the default port if port number is not provided explicitly', async () => {
|
|
@@ -221,15 +247,23 @@ describe('run command tests', () => {
|
|
|
221
247
|
...originalEnv,
|
|
222
248
|
};
|
|
223
249
|
|
|
224
|
-
const
|
|
250
|
+
const cliInput = {
|
|
225
251
|
args: { file: 'src/commands/__fixtures__/sample_mesh.json' },
|
|
226
|
-
flags: {
|
|
252
|
+
flags: {
|
|
253
|
+
port: 5000,
|
|
254
|
+
debug: false,
|
|
255
|
+
inspectPort: 9229,
|
|
256
|
+
},
|
|
227
257
|
};
|
|
228
|
-
|
|
229
|
-
parseSpy.mockResolvedValue(parseOutput);
|
|
258
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
230
259
|
|
|
231
260
|
await RunCommand.run();
|
|
232
|
-
expect(
|
|
261
|
+
expect(start).toHaveBeenCalledWith(
|
|
262
|
+
expect.anything(),
|
|
263
|
+
cliInput.flags.port,
|
|
264
|
+
cliInput.flags.debug,
|
|
265
|
+
cliInput.flags.inspectPort,
|
|
266
|
+
);
|
|
233
267
|
});
|
|
234
268
|
|
|
235
269
|
test('should return error for run command if the mesh has placeholders and env file provided using --env flag is not found', async () => {
|
|
@@ -377,14 +411,6 @@ describe('run command tests', () => {
|
|
|
377
411
|
});
|
|
378
412
|
|
|
379
413
|
test('should successfully run the mesh if provided env file is valid, mesh interpolation is successful and interpolated mesh is a valid JSON', async () => {
|
|
380
|
-
parseSpy.mockResolvedValueOnce({
|
|
381
|
-
args: { file: 'src/commands/__fixtures__/sample_mesh_with_placeholder' },
|
|
382
|
-
flags: {
|
|
383
|
-
env: 'src/commands/__fixtures__/env_valid',
|
|
384
|
-
debug: false,
|
|
385
|
-
},
|
|
386
|
-
});
|
|
387
|
-
|
|
388
414
|
//sampleInterpolated mesh where the mesh string is a valid JSON
|
|
389
415
|
const sampleInterpolatedMesh =
|
|
390
416
|
'{"meshConfig":{"sources":[{"name":"<api-name>","handler":{"graphql":{"endpoint":"<api-url>"}}}],"responseConfig":{"includeHTTPDetails":true}}}';
|
|
@@ -395,8 +421,24 @@ describe('run command tests', () => {
|
|
|
395
421
|
interpolatedMeshData: sampleInterpolatedMesh,
|
|
396
422
|
});
|
|
397
423
|
|
|
424
|
+
const cliInput = {
|
|
425
|
+
args: { file: 'src/commands/__fixtures__/sample_mesh_with_placeholder' },
|
|
426
|
+
flags: {
|
|
427
|
+
env: 'src/commands/__fixtures__/env_valid',
|
|
428
|
+
port: 5000,
|
|
429
|
+
debug: false,
|
|
430
|
+
inspectPort: 9229,
|
|
431
|
+
},
|
|
432
|
+
};
|
|
433
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
434
|
+
|
|
398
435
|
await RunCommand.run();
|
|
399
|
-
expect(
|
|
436
|
+
expect(start).toHaveBeenCalledWith(
|
|
437
|
+
expect.anything(),
|
|
438
|
+
cliInput.flags.port,
|
|
439
|
+
cliInput.flags.debug,
|
|
440
|
+
cliInput.flags.inspectPort,
|
|
441
|
+
);
|
|
400
442
|
});
|
|
401
443
|
|
|
402
444
|
// file import tests
|
|
@@ -429,20 +471,30 @@ describe('run command tests', () => {
|
|
|
429
471
|
],
|
|
430
472
|
};
|
|
431
473
|
|
|
432
|
-
|
|
474
|
+
const cliInput = {
|
|
433
475
|
args: { file: 'src/commands/__fixtures__/sample_mesh_files.json' },
|
|
434
476
|
flags: {
|
|
435
477
|
autoConfirmAction: Promise.resolve(true),
|
|
478
|
+
port: 5000,
|
|
436
479
|
debug: false,
|
|
480
|
+
inspectPort: 9229,
|
|
437
481
|
},
|
|
438
|
-
}
|
|
482
|
+
};
|
|
483
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
439
484
|
|
|
440
485
|
importFiles.mockResolvedValueOnce({
|
|
441
|
-
|
|
486
|
+
data: {
|
|
487
|
+
meshConfig,
|
|
488
|
+
},
|
|
442
489
|
});
|
|
443
490
|
|
|
444
491
|
await RunCommand.run();
|
|
445
|
-
expect(
|
|
492
|
+
expect(start).toHaveBeenCalledWith(
|
|
493
|
+
expect.anything(),
|
|
494
|
+
cliInput.flags.port,
|
|
495
|
+
cliInput.flags.debug,
|
|
496
|
+
cliInput.flags.inspectPort,
|
|
497
|
+
);
|
|
446
498
|
});
|
|
447
499
|
|
|
448
500
|
test('should fail if the file name is more than 25 characters', async () => {
|
|
@@ -608,17 +660,29 @@ describe('run command tests', () => {
|
|
|
608
660
|
|
|
609
661
|
promptConfirm.mockResolvedValueOnce(false).mockResolvedValueOnce(true);
|
|
610
662
|
|
|
611
|
-
importFiles.mockResolvedValueOnce(
|
|
663
|
+
importFiles.mockResolvedValueOnce({
|
|
664
|
+
data: {
|
|
665
|
+
meshConfig,
|
|
666
|
+
},
|
|
667
|
+
});
|
|
612
668
|
|
|
613
|
-
|
|
669
|
+
const cliInput = {
|
|
614
670
|
args: { file: 'src/commands/__fixtures__/sample_mesh_with_files_array.json' },
|
|
615
671
|
flags: {
|
|
672
|
+
port: 5000,
|
|
616
673
|
debug: false,
|
|
674
|
+
inspectPort: 9229,
|
|
617
675
|
},
|
|
618
|
-
}
|
|
676
|
+
};
|
|
677
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
619
678
|
|
|
620
679
|
await RunCommand.run();
|
|
621
|
-
expect(
|
|
680
|
+
expect(start).toHaveBeenCalledWith(
|
|
681
|
+
expect.anything(),
|
|
682
|
+
cliInput.flags.port,
|
|
683
|
+
cliInput.flags.debug,
|
|
684
|
+
cliInput.flags.inspectPort,
|
|
685
|
+
);
|
|
622
686
|
});
|
|
623
687
|
|
|
624
688
|
test('should override if prompt returns Yes, if there is files array', async () => {
|
|
@@ -652,20 +716,30 @@ describe('run command tests', () => {
|
|
|
652
716
|
|
|
653
717
|
promptConfirm.mockResolvedValueOnce(true).mockResolvedValueOnce(true);
|
|
654
718
|
|
|
655
|
-
|
|
719
|
+
const cliInput = {
|
|
656
720
|
args: { file: 'src/commands/__fixtures__/sample_mesh_with_files_array.json' },
|
|
657
721
|
flags: {
|
|
722
|
+
port: 5000,
|
|
658
723
|
debug: false,
|
|
724
|
+
inspectPort: 9229,
|
|
659
725
|
},
|
|
660
|
-
}
|
|
726
|
+
};
|
|
727
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
661
728
|
|
|
662
729
|
importFiles.mockResolvedValueOnce({
|
|
663
|
-
|
|
730
|
+
data: {
|
|
731
|
+
meshConfig,
|
|
732
|
+
},
|
|
664
733
|
});
|
|
665
734
|
|
|
666
735
|
await RunCommand.run();
|
|
667
736
|
|
|
668
|
-
expect(
|
|
737
|
+
expect(start).toHaveBeenCalledWith(
|
|
738
|
+
expect.anything(),
|
|
739
|
+
cliInput.flags.port,
|
|
740
|
+
cliInput.flags.debug,
|
|
741
|
+
cliInput.flags.inspectPort,
|
|
742
|
+
);
|
|
669
743
|
});
|
|
670
744
|
|
|
671
745
|
test('should pass for a fully-qualified meshConfig even if the file does not exist in fileSystem', async () => {
|
|
@@ -697,22 +771,32 @@ describe('run command tests', () => {
|
|
|
697
771
|
],
|
|
698
772
|
};
|
|
699
773
|
|
|
700
|
-
|
|
774
|
+
const cliInput = {
|
|
701
775
|
args: { file: 'src/commands/__fixtures__/sample_fully_qualified_mesh.json' },
|
|
702
776
|
flags: {
|
|
703
777
|
autoConfirmAction: Promise.resolve(true),
|
|
778
|
+
port: 5000,
|
|
704
779
|
debug: false,
|
|
780
|
+
inspectPort: 9229,
|
|
705
781
|
},
|
|
706
|
-
}
|
|
782
|
+
};
|
|
783
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
707
784
|
|
|
708
785
|
promptConfirm.mockResolvedValueOnce(true);
|
|
709
786
|
|
|
710
787
|
importFiles.mockResolvedValueOnce({
|
|
711
|
-
|
|
788
|
+
data: {
|
|
789
|
+
meshConfig,
|
|
790
|
+
},
|
|
712
791
|
});
|
|
713
792
|
|
|
714
793
|
await RunCommand.run();
|
|
715
|
-
expect(
|
|
794
|
+
expect(start).toHaveBeenCalledWith(
|
|
795
|
+
expect.anything(),
|
|
796
|
+
cliInput.flags.port,
|
|
797
|
+
cliInput.flags.debug,
|
|
798
|
+
cliInput.flags.inspectPort,
|
|
799
|
+
);
|
|
716
800
|
});
|
|
717
801
|
|
|
718
802
|
test('should pass if the file is located in subdirectory of mesh directory', async () => {
|
|
@@ -744,21 +828,31 @@ describe('run command tests', () => {
|
|
|
744
828
|
],
|
|
745
829
|
};
|
|
746
830
|
|
|
747
|
-
|
|
831
|
+
const cliInput = {
|
|
748
832
|
args: { file: 'src/commands/__fixtures__/sample_mesh_subdirectory.json' },
|
|
749
833
|
flags: {
|
|
750
834
|
autoConfirmAction: Promise.resolve(true),
|
|
835
|
+
port: 5000,
|
|
751
836
|
debug: false,
|
|
837
|
+
inspectPort: 9229,
|
|
752
838
|
},
|
|
753
|
-
}
|
|
839
|
+
};
|
|
840
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
754
841
|
|
|
755
842
|
importFiles.mockResolvedValueOnce({
|
|
756
|
-
|
|
843
|
+
data: {
|
|
844
|
+
meshConfig,
|
|
845
|
+
},
|
|
757
846
|
});
|
|
758
847
|
|
|
759
848
|
await RunCommand.run();
|
|
760
849
|
|
|
761
|
-
expect(
|
|
850
|
+
expect(start).toHaveBeenCalledWith(
|
|
851
|
+
expect.anything(),
|
|
852
|
+
cliInput.flags.port,
|
|
853
|
+
cliInput.flags.debug,
|
|
854
|
+
cliInput.flags.inspectPort,
|
|
855
|
+
);
|
|
762
856
|
});
|
|
763
857
|
|
|
764
858
|
test('should fail if the file is outside the workspace directory', async () => {
|
|
@@ -919,17 +1013,25 @@ describe('run command tests', () => {
|
|
|
919
1013
|
});
|
|
920
1014
|
|
|
921
1015
|
test('should successfully run the mesh if provided secrets file is valid', async () => {
|
|
922
|
-
|
|
1016
|
+
const cliInput = {
|
|
923
1017
|
args: { file: 'src/commands/__fixtures__/sample_secrets_mesh.json' },
|
|
924
1018
|
flags: {
|
|
925
1019
|
secrets: 'src/commands/__fixtures__/secrets_valid.yaml',
|
|
1020
|
+
port: 5000,
|
|
926
1021
|
debug: false,
|
|
1022
|
+
inspectPort: 9229,
|
|
927
1023
|
},
|
|
928
|
-
}
|
|
1024
|
+
};
|
|
1025
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
929
1026
|
|
|
930
1027
|
await RunCommand.run();
|
|
931
1028
|
expect(writeSecretsFile).toHaveBeenCalled();
|
|
932
|
-
expect(
|
|
1029
|
+
expect(start).toHaveBeenCalledWith(
|
|
1030
|
+
expect.anything(),
|
|
1031
|
+
cliInput.flags.port,
|
|
1032
|
+
cliInput.flags.debug,
|
|
1033
|
+
cliInput.flags.inspectPort,
|
|
1034
|
+
);
|
|
933
1035
|
});
|
|
934
1036
|
|
|
935
1037
|
test('should return error if ran with secrets against windows platform with batch variables', async () => {
|
|
@@ -957,48 +1059,72 @@ describe('run command tests', () => {
|
|
|
957
1059
|
|
|
958
1060
|
test('should pass if ran with secrets against linux platform with batch variables', async () => {
|
|
959
1061
|
platformSpy.mockReturnValue('linux');
|
|
960
|
-
|
|
1062
|
+
const cliInput = {
|
|
961
1063
|
args: { file: 'src/commands/__fixtures__/sample_secrets_mesh.json' },
|
|
962
1064
|
flags: {
|
|
963
1065
|
secrets: 'src/commands/__fixtures__/secrets_with_batch_variables.yaml',
|
|
1066
|
+
port: 5000,
|
|
964
1067
|
debug: false,
|
|
1068
|
+
inspectPort: 9229,
|
|
965
1069
|
},
|
|
966
|
-
}
|
|
1070
|
+
};
|
|
1071
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
967
1072
|
|
|
968
1073
|
await RunCommand.run();
|
|
969
1074
|
expect(writeSecretsFile).toHaveBeenCalled();
|
|
970
|
-
expect(
|
|
1075
|
+
expect(start).toHaveBeenCalledWith(
|
|
1076
|
+
expect.anything(),
|
|
1077
|
+
cliInput.flags.port,
|
|
1078
|
+
cliInput.flags.debug,
|
|
1079
|
+
cliInput.flags.inspectPort,
|
|
1080
|
+
);
|
|
971
1081
|
});
|
|
972
1082
|
|
|
973
1083
|
test('should pass if ran with secrets against darwin(macOS) platform with batch variables', async () => {
|
|
974
1084
|
platformSpy.mockReturnValue('darwin');
|
|
975
|
-
|
|
1085
|
+
const cliInput = {
|
|
976
1086
|
args: { file: 'src/commands/__fixtures__/sample_secrets_mesh.json' },
|
|
977
1087
|
flags: {
|
|
978
1088
|
secrets: 'src/commands/__fixtures__/secrets_with_batch_variables.yaml',
|
|
1089
|
+
port: 5000,
|
|
979
1090
|
debug: false,
|
|
1091
|
+
inspectPort: 9229,
|
|
980
1092
|
},
|
|
981
|
-
}
|
|
1093
|
+
};
|
|
1094
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
982
1095
|
|
|
983
1096
|
await RunCommand.run();
|
|
984
1097
|
expect(writeSecretsFile).toHaveBeenCalled();
|
|
985
|
-
expect(
|
|
1098
|
+
expect(start).toHaveBeenCalledWith(
|
|
1099
|
+
expect.anything(),
|
|
1100
|
+
cliInput.flags.port,
|
|
1101
|
+
cliInput.flags.debug,
|
|
1102
|
+
cliInput.flags.inspectPort,
|
|
1103
|
+
);
|
|
986
1104
|
});
|
|
987
1105
|
|
|
988
1106
|
test('should escape variables that are preceded by backslash symbol', async () => {
|
|
989
|
-
|
|
1107
|
+
const cliInput = {
|
|
990
1108
|
args: { file: 'src/commands/__fixtures__/sample_mesh_with_escaped_secrets.json' },
|
|
991
1109
|
flags: {
|
|
992
1110
|
secrets: 'src/commands/__fixtures__/secrets_with_escaped_variables.yaml',
|
|
1111
|
+
port: 5000,
|
|
993
1112
|
debug: false,
|
|
1113
|
+
inspectPort: 9229,
|
|
994
1114
|
},
|
|
995
|
-
}
|
|
1115
|
+
};
|
|
1116
|
+
parseSpy.mockResolvedValueOnce(cliInput);
|
|
996
1117
|
|
|
997
1118
|
await RunCommand.run();
|
|
998
1119
|
expect(writeSecretsFile).toHaveBeenCalledWith(
|
|
999
1120
|
'Home: rootPath\nHomeString: $HOME\nHomeWithSlash: \\rootPath\nHomeStringWithSlash: \\$HOME\n',
|
|
1000
1121
|
expect.anything(),
|
|
1001
1122
|
);
|
|
1002
|
-
expect(
|
|
1123
|
+
expect(start).toHaveBeenCalledWith(
|
|
1124
|
+
expect.anything(),
|
|
1125
|
+
cliInput.flags.port,
|
|
1126
|
+
cliInput.flags.debug,
|
|
1127
|
+
cliInput.flags.inspectPort,
|
|
1128
|
+
);
|
|
1003
1129
|
});
|
|
1004
1130
|
});
|