@hubspot/cli 8.3.0 → 8.4.0-beta.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/bin/cli.js +2 -0
- package/commands/account/auth.js +12 -22
- package/commands/account/clean.js +5 -6
- package/commands/account/createOverride.js +7 -7
- package/commands/account/info.js +2 -1
- package/commands/account/list.js +3 -5
- package/commands/account/remove.js +2 -3
- package/commands/account/removeOverride.js +8 -10
- package/commands/account/rename.js +5 -6
- package/commands/account/use.js +8 -19
- package/commands/api.d.ts +10 -0
- package/commands/api.js +164 -0
- package/commands/app/migrate.js +8 -8
- package/commands/app/secret/add.js +6 -7
- package/commands/app/secret/delete.js +9 -10
- package/commands/app/secret/list.js +6 -7
- package/commands/app/secret/update.js +8 -9
- package/commands/auth.js +12 -12
- package/commands/cms/app/create.js +9 -5
- package/commands/cms/convertFields.js +8 -8
- package/commands/cms/delete.js +2 -3
- package/commands/cms/fetch.js +7 -7
- package/commands/cms/function/create.js +9 -5
- package/commands/cms/function/deploy.js +2 -3
- package/commands/cms/function/list.js +11 -7
- package/commands/cms/function/logs.js +17 -23
- package/commands/cms/function/server.js +2 -3
- package/commands/cms/getReactModule.js +7 -8
- package/commands/cms/lighthouseScore.js +25 -24
- package/commands/cms/lint.js +4 -5
- package/commands/cms/list.js +5 -6
- package/commands/cms/module/create.js +9 -5
- package/commands/cms/module/marketplace-validate.js +7 -8
- package/commands/cms/mv.js +2 -3
- package/commands/cms/template/create.js +10 -6
- package/commands/cms/theme/create.js +5 -5
- package/commands/cms/theme/generate-selectors.js +5 -4
- package/commands/cms/theme/marketplace-validate.js +8 -9
- package/commands/cms/theme/preview.js +16 -8
- package/commands/cms/upload.js +15 -12
- package/commands/cms/watch.js +5 -5
- package/commands/cms/webpack/create.js +5 -5
- package/commands/completion.js +3 -5
- package/commands/config/migrate.js +6 -7
- package/commands/config/set.js +5 -6
- package/commands/customObject/create.js +4 -5
- package/commands/customObject/createSchema.js +4 -5
- package/commands/customObject/deleteSchema.js +4 -5
- package/commands/customObject/fetchAllSchemas.js +2 -3
- package/commands/customObject/fetchSchema.js +2 -3
- package/commands/customObject/listSchemas.js +2 -3
- package/commands/customObject/updateSchema.js +4 -5
- package/commands/doctor.js +8 -8
- package/commands/feedback.js +6 -4
- package/commands/filemanager/fetch.js +5 -6
- package/commands/filemanager/upload.js +5 -5
- package/commands/getStarted.js +14 -16
- package/commands/hubdb/clear.js +5 -6
- package/commands/hubdb/create.js +4 -5
- package/commands/hubdb/delete.js +8 -9
- package/commands/hubdb/fetch.js +5 -6
- package/commands/hubdb/list.js +16 -14
- package/commands/init.js +14 -17
- package/commands/mcp/setup.js +5 -6
- package/commands/mcp/start.js +2 -3
- package/commands/open.js +4 -5
- package/commands/project/add.js +10 -5
- package/commands/project/create.js +10 -10
- package/commands/project/delete.d.ts +7 -0
- package/commands/project/delete.js +74 -0
- package/commands/project/deploy.js +36 -34
- package/commands/project/dev/deprecatedFlow.js +42 -15
- package/commands/project/dev/index.d.ts +3 -3
- package/commands/project/dev/index.js +24 -30
- package/commands/project/dev/unifiedFlow.js +37 -14
- package/commands/project/download.js +10 -11
- package/commands/project/info.d.ts +4 -0
- package/commands/project/info.js +67 -0
- package/commands/project/installDeps.js +9 -6
- package/commands/project/lint.js +11 -8
- package/commands/project/list.js +14 -14
- package/commands/project/listBuilds.js +8 -6
- package/commands/project/logs.js +5 -6
- package/commands/project/migrate.js +8 -8
- package/commands/project/open.js +5 -6
- package/commands/project/profile/add.js +12 -8
- package/commands/project/profile/delete.js +15 -11
- package/commands/project/updateDeps.js +9 -6
- package/commands/project/upload.js +31 -17
- package/commands/project/validate.js +11 -11
- package/commands/project/watch.js +20 -20
- package/commands/project.js +4 -0
- package/commands/sandbox/create.js +15 -15
- package/commands/sandbox/delete.js +13 -14
- package/commands/secret/addSecret.js +6 -7
- package/commands/secret/deleteSecret.js +5 -6
- package/commands/secret/listSecret.js +2 -3
- package/commands/secret/updateSecret.js +4 -5
- package/commands/testAccount/create.d.ts +1 -1
- package/commands/testAccount/create.js +20 -16
- package/commands/testAccount/createConfig.js +7 -8
- package/commands/testAccount/delete.js +27 -18
- package/commands/testAccount/importData.js +6 -7
- package/commands/upgrade.js +9 -10
- package/lang/en.d.ts +114 -5
- package/lang/en.js +111 -5
- package/lib/accountAuth.js +2 -2
- package/lib/buildAccount.js +3 -3
- package/lib/doctor/Diagnosis.js +5 -5
- package/lib/errorHandlers/index.js +4 -3
- package/lib/errorHandlers/suppressError.js +4 -0
- package/lib/errors/PromptExitError.d.ts +4 -2
- package/lib/errors/PromptExitError.js +3 -0
- package/lib/process.d.ts +1 -1
- package/lib/process.js +10 -3
- package/lib/projects/delete.d.ts +13 -0
- package/lib/projects/delete.js +193 -0
- package/lib/projects/localDev/AppDevModeInterface.js +11 -11
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +3 -1
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +2 -2
- package/lib/projects/localDev/DevSessionManager.d.ts +6 -3
- package/lib/projects/localDev/DevSessionManager.js +31 -19
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +3 -0
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +16 -12
- package/lib/projects/localDev/LocalDevProcess.js +6 -5
- package/lib/projects/localDev/LocalDevState.d.ts +3 -2
- package/lib/projects/localDev/LocalDevState.js +3 -1
- package/lib/projects/localDev/helpers/account.d.ts +4 -3
- package/lib/projects/localDev/helpers/account.js +16 -19
- package/lib/projects/localDev/helpers/process.d.ts +1 -1
- package/lib/projects/localDev/helpers/process.js +4 -10
- package/lib/projects/localDev/helpers/project.d.ts +4 -3
- package/lib/projects/localDev/helpers/project.js +31 -15
- package/lib/projects/projectInfo.d.ts +5 -0
- package/lib/projects/projectInfo.js +82 -0
- package/lib/projects/projectProfiles.d.ts +1 -2
- package/lib/projects/projectProfiles.js +5 -17
- package/lib/prompts/createApiSamplePrompt.js +4 -0
- package/lib/prompts/projectProfilePrompt.d.ts +2 -0
- package/lib/prompts/projectProfilePrompt.js +46 -0
- package/lib/prompts/promptUtils.js +3 -2
- package/lib/prompts/selectHubDBTablePrompt.js +2 -2
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +2 -2
- package/lib/theme/cmsDevServerProcess.d.ts +2 -0
- package/lib/theme/cmsDevServerProcess.js +7 -6
- package/lib/ui/SpinniesManager.d.ts +1 -0
- package/lib/ui/SpinniesManager.js +20 -6
- package/lib/ui/spinniesUtils.d.ts +0 -1
- package/lib/ui/spinniesUtils.js +6 -16
- package/lib/usageTracking.d.ts +3 -4
- package/lib/yargs/makeYargsBuilder.d.ts +13 -0
- package/lib/yargs/makeYargsBuilder.js +33 -0
- package/lib/yargs/makeYargsHandlerWithUsageTracking.d.ts +3 -0
- package/lib/yargs/makeYargsHandlerWithUsageTracking.js +95 -0
- package/lib/yargs/strictEnforceBoolean.d.ts +1 -0
- package/lib/yargs/strictEnforceBoolean.js +13 -0
- package/lib/yargsUtils.d.ts +3 -16
- package/lib/yargsUtils.js +3 -48
- package/package.json +9 -4
- package/types/LocalDev.d.ts +5 -0
- package/types/Projects.d.ts +19 -0
- package/types/Yargs.d.ts +18 -1
- package/api/__tests__/migrate.test.d.ts +0 -1
- package/api/__tests__/migrate.test.js +0 -199
- package/commands/__tests__/account.test.d.ts +0 -1
- package/commands/__tests__/account.test.js +0 -69
- package/commands/__tests__/auth.test.d.ts +0 -1
- package/commands/__tests__/auth.test.js +0 -43
- package/commands/__tests__/cms.test.d.ts +0 -1
- package/commands/__tests__/cms.test.js +0 -87
- package/commands/__tests__/config.test.d.ts +0 -1
- package/commands/__tests__/config.test.js +0 -44
- package/commands/__tests__/customObject.test.d.ts +0 -1
- package/commands/__tests__/customObject.test.js +0 -68
- package/commands/__tests__/doctor.test.d.ts +0 -1
- package/commands/__tests__/doctor.test.js +0 -132
- package/commands/__tests__/feedback.test.d.ts +0 -1
- package/commands/__tests__/feedback.test.js +0 -24
- package/commands/__tests__/filemanager.test.d.ts +0 -1
- package/commands/__tests__/filemanager.test.js +0 -45
- package/commands/__tests__/getStarted.test.d.ts +0 -1
- package/commands/__tests__/getStarted.test.js +0 -173
- package/commands/__tests__/hubdb.test.d.ts +0 -1
- package/commands/__tests__/hubdb.test.js +0 -50
- package/commands/__tests__/init.test.d.ts +0 -1
- package/commands/__tests__/init.test.js +0 -42
- package/commands/__tests__/mcp.test.d.ts +0 -1
- package/commands/__tests__/mcp.test.js +0 -46
- package/commands/__tests__/open.test.d.ts +0 -1
- package/commands/__tests__/open.test.js +0 -58
- package/commands/__tests__/project.test.d.ts +0 -1
- package/commands/__tests__/project.test.js +0 -125
- package/commands/__tests__/sandbox.test.d.ts +0 -1
- package/commands/__tests__/sandbox.test.js +0 -44
- package/commands/__tests__/secret.test.d.ts +0 -1
- package/commands/__tests__/secret.test.js +0 -49
- package/commands/__tests__/testAccount.test.d.ts +0 -1
- package/commands/__tests__/testAccount.test.js +0 -57
- package/commands/__tests__/upgrade.test.d.ts +0 -1
- package/commands/__tests__/upgrade.test.js +0 -309
- package/commands/account/__tests__/auth.test.d.ts +0 -1
- package/commands/account/__tests__/auth.test.js +0 -206
- package/commands/account/__tests__/clean.test.d.ts +0 -1
- package/commands/account/__tests__/clean.test.js +0 -28
- package/commands/account/__tests__/createOverride.test.d.ts +0 -1
- package/commands/account/__tests__/createOverride.test.js +0 -32
- package/commands/account/__tests__/info.test.d.ts +0 -1
- package/commands/account/__tests__/info.test.js +0 -28
- package/commands/account/__tests__/list.test.d.ts +0 -1
- package/commands/account/__tests__/list.test.js +0 -153
- package/commands/account/__tests__/remove.test.d.ts +0 -1
- package/commands/account/__tests__/remove.test.js +0 -36
- package/commands/account/__tests__/removeOverride.d.ts +0 -1
- package/commands/account/__tests__/removeOverride.js +0 -25
- package/commands/account/__tests__/rename.test.d.ts +0 -1
- package/commands/account/__tests__/rename.test.js +0 -82
- package/commands/account/__tests__/use.test.d.ts +0 -1
- package/commands/account/__tests__/use.test.js +0 -170
- package/commands/app/__tests__/migrate.test.d.ts +0 -1
- package/commands/app/__tests__/migrate.test.js +0 -111
- package/commands/app/secret/__tests__/add.test.d.ts +0 -1
- package/commands/app/secret/__tests__/add.test.js +0 -140
- package/commands/app/secret/__tests__/delete.test.d.ts +0 -1
- package/commands/app/secret/__tests__/delete.test.js +0 -28
- package/commands/app/secret/__tests__/list.test.d.ts +0 -1
- package/commands/app/secret/__tests__/list.test.js +0 -25
- package/commands/app/secret/__tests__/update.test.d.ts +0 -1
- package/commands/app/secret/__tests__/update.test.js +0 -28
- package/commands/cms/__tests__/delete.test.d.ts +0 -1
- package/commands/cms/__tests__/delete.test.js +0 -39
- package/commands/cms/__tests__/fetch.test.d.ts +0 -1
- package/commands/cms/__tests__/fetch.test.js +0 -156
- package/commands/cms/__tests__/function.test.d.ts +0 -1
- package/commands/cms/__tests__/function.test.js +0 -50
- package/commands/cms/__tests__/lint.test.d.ts +0 -1
- package/commands/cms/__tests__/lint.test.js +0 -33
- package/commands/cms/__tests__/list.test.d.ts +0 -1
- package/commands/cms/__tests__/list.test.js +0 -42
- package/commands/cms/__tests__/module.test.d.ts +0 -1
- package/commands/cms/__tests__/module.test.js +0 -45
- package/commands/cms/__tests__/mv.test.d.ts +0 -1
- package/commands/cms/__tests__/mv.test.js +0 -46
- package/commands/cms/__tests__/theme.test.d.ts +0 -1
- package/commands/cms/__tests__/theme.test.js +0 -54
- package/commands/cms/__tests__/upload.test.d.ts +0 -1
- package/commands/cms/__tests__/upload.test.js +0 -312
- package/commands/cms/__tests__/watch.test.d.ts +0 -1
- package/commands/cms/__tests__/watch.test.js +0 -204
- package/commands/cms/function/__tests__/logs.test.d.ts +0 -1
- package/commands/cms/function/__tests__/logs.test.js +0 -70
- package/commands/cms/theme/__tests__/generate-selectors.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/generate-selectors.test.js +0 -28
- package/commands/cms/theme/__tests__/marketplace-validate.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/marketplace-validate.test.js +0 -36
- package/commands/cms/theme/__tests__/preview.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/preview.test.js +0 -54
- package/commands/customObject/__tests__/create.test.d.ts +0 -1
- package/commands/customObject/__tests__/create.test.js +0 -40
- package/commands/customObject/__tests__/createSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/createSchema.test.js +0 -28
- package/commands/customObject/__tests__/deleteSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/deleteSchema.test.js +0 -42
- package/commands/customObject/__tests__/fetch-all-schemas.test.d.ts +0 -1
- package/commands/customObject/__tests__/fetch-all-schemas.test.js +0 -41
- package/commands/customObject/__tests__/fetchSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/fetchSchema.test.js +0 -45
- package/commands/customObject/__tests__/listSchemas.test.d.ts +0 -1
- package/commands/customObject/__tests__/listSchemas.test.js +0 -29
- package/commands/customObject/__tests__/updateSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/updateSchema.test.js +0 -40
- package/commands/filemanager/__tests__/fetch.test.d.ts +0 -1
- package/commands/filemanager/__tests__/fetch.test.js +0 -32
- package/commands/filemanager/__tests__/upload.test.d.ts +0 -1
- package/commands/filemanager/__tests__/upload.test.js +0 -191
- package/commands/hubdb/__tests__/clear.test.d.ts +0 -1
- package/commands/hubdb/__tests__/clear.test.js +0 -28
- package/commands/hubdb/__tests__/create.test.d.ts +0 -1
- package/commands/hubdb/__tests__/create.test.js +0 -28
- package/commands/hubdb/__tests__/delete.test.d.ts +0 -1
- package/commands/hubdb/__tests__/delete.test.js +0 -28
- package/commands/hubdb/__tests__/fetch.test.d.ts +0 -1
- package/commands/hubdb/__tests__/fetch.test.js +0 -28
- package/commands/hubdb/__tests__/list.test.d.ts +0 -1
- package/commands/hubdb/__tests__/list.test.js +0 -88
- package/commands/mcp/__tests__/setup.test.d.ts +0 -1
- package/commands/mcp/__tests__/setup.test.js +0 -26
- package/commands/mcp/__tests__/start.test.d.ts +0 -1
- package/commands/mcp/__tests__/start.test.js +0 -144
- package/commands/project/__tests__/add.test.d.ts +0 -1
- package/commands/project/__tests__/add.test.js +0 -107
- package/commands/project/__tests__/create.test.d.ts +0 -1
- package/commands/project/__tests__/create.test.js +0 -97
- package/commands/project/__tests__/deploy.test.d.ts +0 -1
- package/commands/project/__tests__/deploy.test.js +0 -307
- package/commands/project/__tests__/dev.test.d.ts +0 -1
- package/commands/project/__tests__/dev.test.js +0 -273
- package/commands/project/__tests__/devUnifiedFlow.test.d.ts +0 -1
- package/commands/project/__tests__/devUnifiedFlow.test.js +0 -434
- package/commands/project/__tests__/download.test.d.ts +0 -1
- package/commands/project/__tests__/download.test.js +0 -39
- package/commands/project/__tests__/installDeps.test.d.ts +0 -1
- package/commands/project/__tests__/installDeps.test.js +0 -140
- package/commands/project/__tests__/lint.test.d.ts +0 -1
- package/commands/project/__tests__/lint.test.js +0 -704
- package/commands/project/__tests__/list.test.d.ts +0 -1
- package/commands/project/__tests__/list.test.js +0 -31
- package/commands/project/__tests__/listBuilds.test.d.ts +0 -1
- package/commands/project/__tests__/listBuilds.test.js +0 -38
- package/commands/project/__tests__/logs.test.d.ts +0 -1
- package/commands/project/__tests__/logs.test.js +0 -202
- package/commands/project/__tests__/migrate.test.d.ts +0 -1
- package/commands/project/__tests__/migrate.test.js +0 -106
- package/commands/project/__tests__/open.test.d.ts +0 -1
- package/commands/project/__tests__/open.test.js +0 -39
- package/commands/project/__tests__/profile.test.d.ts +0 -1
- package/commands/project/__tests__/profile.test.js +0 -42
- package/commands/project/__tests__/updateDeps.test.d.ts +0 -1
- package/commands/project/__tests__/updateDeps.test.js +0 -140
- package/commands/project/__tests__/upload.test.d.ts +0 -1
- package/commands/project/__tests__/upload.test.js +0 -234
- package/commands/project/__tests__/validate.test.d.ts +0 -1
- package/commands/project/__tests__/validate.test.js +0 -381
- package/commands/project/__tests__/watch.test.d.ts +0 -1
- package/commands/project/__tests__/watch.test.js +0 -35
- package/commands/sandbox/__tests__/create.test.d.ts +0 -1
- package/commands/sandbox/__tests__/create.test.js +0 -198
- package/commands/sandbox/__tests__/delete.test.d.ts +0 -1
- package/commands/sandbox/__tests__/delete.test.js +0 -31
- package/commands/secret/__tests__/addSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/addSecret.test.js +0 -162
- package/commands/secret/__tests__/deleteSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/deleteSecret.test.js +0 -41
- package/commands/secret/__tests__/listSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/listSecret.test.js +0 -29
- package/commands/secret/__tests__/updateSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/updateSecret.test.js +0 -29
- package/commands/testAccount/__tests__/create.test.d.ts +0 -1
- package/commands/testAccount/__tests__/create.test.js +0 -106
- package/commands/testAccount/__tests__/createConfig.test.d.ts +0 -1
- package/commands/testAccount/__tests__/createConfig.test.js +0 -32
- package/commands/testAccount/__tests__/delete.test.d.ts +0 -1
- package/commands/testAccount/__tests__/delete.test.js +0 -29
- package/commands/testAccount/__tests__/importData.test.d.ts +0 -1
- package/commands/testAccount/__tests__/importData.test.js +0 -92
- package/lib/__tests__/CLIWebSocketServer.test.d.ts +0 -1
- package/lib/__tests__/CLIWebSocketServer.test.js +0 -252
- package/lib/__tests__/accountAuth.test.d.ts +0 -1
- package/lib/__tests__/accountAuth.test.js +0 -258
- package/lib/__tests__/accountTypes.test.d.ts +0 -1
- package/lib/__tests__/accountTypes.test.js +0 -98
- package/lib/__tests__/buildAccount.test.d.ts +0 -1
- package/lib/__tests__/buildAccount.test.js +0 -211
- package/lib/__tests__/cliUpgradeUtils.test.d.ts +0 -1
- package/lib/__tests__/cliUpgradeUtils.test.js +0 -131
- package/lib/__tests__/commandSuggestion.test.d.ts +0 -1
- package/lib/__tests__/commandSuggestion.test.js +0 -121
- package/lib/__tests__/commonOpts.test.d.ts +0 -1
- package/lib/__tests__/commonOpts.test.js +0 -80
- package/lib/__tests__/dependencyManagement.test.d.ts +0 -1
- package/lib/__tests__/dependencyManagement.test.js +0 -1067
- package/lib/__tests__/developerTestAccounts.test.d.ts +0 -1
- package/lib/__tests__/developerTestAccounts.test.js +0 -156
- package/lib/__tests__/hasFeature.test.d.ts +0 -1
- package/lib/__tests__/hasFeature.test.js +0 -167
- package/lib/__tests__/http.test.d.ts +0 -1
- package/lib/__tests__/http.test.js +0 -40
- package/lib/__tests__/importData.test.d.ts +0 -1
- package/lib/__tests__/importData.test.js +0 -98
- package/lib/__tests__/npmCli.test.d.ts +0 -1
- package/lib/__tests__/npmCli.test.js +0 -84
- package/lib/__tests__/oauth.test.d.ts +0 -1
- package/lib/__tests__/oauth.test.js +0 -109
- package/lib/__tests__/parsing.test.d.ts +0 -1
- package/lib/__tests__/parsing.test.js +0 -34
- package/lib/__tests__/polling.test.d.ts +0 -1
- package/lib/__tests__/polling.test.js +0 -76
- package/lib/__tests__/process.test.d.ts +0 -1
- package/lib/__tests__/process.test.js +0 -89
- package/lib/__tests__/sandboxes.test.d.ts +0 -1
- package/lib/__tests__/sandboxes.test.js +0 -128
- package/lib/__tests__/serverlessLogs.test.d.ts +0 -1
- package/lib/__tests__/serverlessLogs.test.js +0 -163
- package/lib/__tests__/usageTracking.test.d.ts +0 -1
- package/lib/__tests__/usageTracking.test.js +0 -197
- package/lib/__tests__/validation.test.d.ts +0 -1
- package/lib/__tests__/validation.test.js +0 -143
- package/lib/__tests__/yargsUtils.test.d.ts +0 -1
- package/lib/__tests__/yargsUtils.test.js +0 -124
- package/lib/app/__tests__/migrate.test.d.ts +0 -1
- package/lib/app/__tests__/migrate.test.js +0 -638
- package/lib/doctor/__tests__/Diagnosis.test.d.ts +0 -1
- package/lib/doctor/__tests__/Diagnosis.test.js +0 -84
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +0 -1
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +0 -177
- package/lib/doctor/__tests__/Doctor.test.d.ts +0 -1
- package/lib/doctor/__tests__/Doctor.test.js +0 -560
- package/lib/errorHandlers/__tests__/index.test.d.ts +0 -1
- package/lib/errorHandlers/__tests__/index.test.js +0 -278
- package/lib/mcp/__tests__/setup.test.d.ts +0 -1
- package/lib/mcp/__tests__/setup.test.js +0 -523
- package/lib/middleware/__tests__/commandTargetingUtils.test.d.ts +0 -1
- package/lib/middleware/__tests__/commandTargetingUtils.test.js +0 -99
- package/lib/middleware/__tests__/configMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/configMiddleware.test.js +0 -118
- package/lib/middleware/__tests__/gitMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/gitMiddleware.test.js +0 -43
- package/lib/middleware/__tests__/requestMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/requestMiddleware.test.js +0 -15
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.js +0 -44
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.js +0 -39
- package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +0 -1
- package/lib/projects/__tests__/AppDevModeInterface.test.js +0 -541
- package/lib/projects/__tests__/DevServerManager.test.d.ts +0 -1
- package/lib/projects/__tests__/DevServerManager.test.js +0 -185
- package/lib/projects/__tests__/DevSessionManager.test.d.ts +0 -1
- package/lib/projects/__tests__/DevSessionManager.test.js +0 -250
- package/lib/projects/__tests__/LocalDevProcess.test.d.ts +0 -1
- package/lib/projects/__tests__/LocalDevProcess.test.js +0 -481
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +0 -1
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +0 -231
- package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +0 -1
- package/lib/projects/__tests__/ProjectLogsManager.test.js +0 -302
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +0 -1
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +0 -160
- package/lib/projects/__tests__/components.test.d.ts +0 -1
- package/lib/projects/__tests__/components.test.js +0 -440
- package/lib/projects/__tests__/deploy.test.d.ts +0 -1
- package/lib/projects/__tests__/deploy.test.js +0 -231
- package/lib/projects/__tests__/localDevProjectHelpers.test.d.ts +0 -1
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +0 -120
- package/lib/projects/__tests__/platformVersion.test.d.ts +0 -1
- package/lib/projects/__tests__/platformVersion.test.js +0 -63
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.d.ts +0 -1
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.js +0 -328
- package/lib/projects/__tests__/projectProfiles.test.d.ts +0 -1
- package/lib/projects/__tests__/projectProfiles.test.js +0 -441
- package/lib/projects/__tests__/projects.test.d.ts +0 -1
- package/lib/projects/__tests__/projects.test.js +0 -58
- package/lib/projects/__tests__/structure.test.d.ts +0 -1
- package/lib/projects/__tests__/structure.test.js +0 -210
- package/lib/projects/__tests__/uieLinting.test.d.ts +0 -1
- package/lib/projects/__tests__/uieLinting.test.js +0 -631
- package/lib/projects/__tests__/upload.test.d.ts +0 -1
- package/lib/projects/__tests__/upload.test.js +0 -183
- package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +0 -1
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +0 -245
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +0 -1
- package/lib/projects/add/__tests__/v2AddComponent.test.js +0 -343
- package/lib/projects/create/__tests__/legacy.test.d.ts +0 -1
- package/lib/projects/create/__tests__/legacy.test.js +0 -72
- package/lib/projects/create/__tests__/v2.test.d.ts +0 -1
- package/lib/projects/create/__tests__/v2.test.js +0 -257
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +0 -157
- package/lib/prompts/__tests__/createFunctionPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createFunctionPrompt.test.js +0 -129
- package/lib/prompts/__tests__/createModulePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createModulePrompt.test.js +0 -187
- package/lib/prompts/__tests__/createTemplatePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createTemplatePrompt.test.js +0 -102
- package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +0 -31
- package/lib/prompts/__tests__/projectAddPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/projectAddPrompt.test.js +0 -143
- package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +0 -37
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.js +0 -160
- package/lib/theme/__tests__/migrate.test.d.ts +0 -1
- package/lib/theme/__tests__/migrate.test.js +0 -247
- package/lib/ui/__tests__/SpinniesManager.test.d.ts +0 -1
- package/lib/ui/__tests__/SpinniesManager.test.js +0 -488
- package/lib/ui/__tests__/removeAnsiCodes.test.d.ts +0 -1
- package/lib/ui/__tests__/removeAnsiCodes.test.js +0 -84
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +0 -254
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +0 -227
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +0 -208
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +0 -186
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +0 -124
- package/mcp-server/tools/cms/__tests__/HsListTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +0 -124
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +0 -157
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +0 -131
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +0 -461
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +0 -125
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +0 -125
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +0 -210
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +0 -146
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +0 -124
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +0 -307
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +0 -242
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +0 -209
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +0 -158
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +0 -187
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +0 -118
- package/mcp-server/utils/__tests__/command.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/command.test.js +0 -275
- package/mcp-server/utils/__tests__/content.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/content.test.js +0 -164
- package/mcp-server/utils/__tests__/feedbackTracking.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +0 -69
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
|
-
import * as commonOpts from '../../../lib/commonOpts.js';
|
|
3
|
-
import mvCommand from '../mv.js';
|
|
4
|
-
vi.mock('../../../lib/commonOpts');
|
|
5
|
-
const positionalSpy = vi
|
|
6
|
-
.spyOn(yargs, 'positional')
|
|
7
|
-
.mockReturnValue(yargs);
|
|
8
|
-
describe('commands/cms/mv', () => {
|
|
9
|
-
describe('command', () => {
|
|
10
|
-
it('should have the correct command structure', () => {
|
|
11
|
-
expect(mvCommand.command).toBe('mv <srcPath> <destPath>');
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
describe('describe', () => {
|
|
15
|
-
it('should provide a description', () => {
|
|
16
|
-
expect(mvCommand.describe).toBeDefined();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
describe('builder', () => {
|
|
20
|
-
it('should support the correct options', () => {
|
|
21
|
-
mvCommand.builder(yargs);
|
|
22
|
-
expect(commonOpts.addGlobalOptions).toHaveBeenCalledTimes(1);
|
|
23
|
-
expect(commonOpts.addGlobalOptions).toHaveBeenCalledWith(yargs);
|
|
24
|
-
expect(commonOpts.addConfigOptions).toHaveBeenCalledTimes(1);
|
|
25
|
-
expect(commonOpts.addConfigOptions).toHaveBeenCalledWith(yargs);
|
|
26
|
-
expect(commonOpts.addAccountOptions).toHaveBeenCalledTimes(1);
|
|
27
|
-
expect(commonOpts.addAccountOptions).toHaveBeenCalledWith(yargs);
|
|
28
|
-
expect(commonOpts.addUseEnvironmentOptions).toHaveBeenCalledTimes(1);
|
|
29
|
-
expect(commonOpts.addUseEnvironmentOptions).toHaveBeenCalledWith(yargs);
|
|
30
|
-
});
|
|
31
|
-
it('should add the srcPath positional argument', () => {
|
|
32
|
-
mvCommand.builder(yargs);
|
|
33
|
-
expect(positionalSpy).toHaveBeenCalledWith('srcPath', {
|
|
34
|
-
describe: 'Remote hubspot path',
|
|
35
|
-
type: 'string',
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
it('should add the destPath positional argument', () => {
|
|
39
|
-
mvCommand.builder(yargs);
|
|
40
|
-
expect(positionalSpy).toHaveBeenCalledWith('destPath', {
|
|
41
|
-
describe: 'Remote hubspot path',
|
|
42
|
-
type: 'string',
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
|
-
import preview from '../theme/preview.js';
|
|
3
|
-
import generateSelectors from '../theme/generate-selectors.js';
|
|
4
|
-
import marketplaceValidate from '../theme/marketplace-validate.js';
|
|
5
|
-
import create from '../theme/create.js';
|
|
6
|
-
import themeCommands from '../theme.js';
|
|
7
|
-
vi.mock('../theme/preview');
|
|
8
|
-
vi.mock('../theme/generate-selectors');
|
|
9
|
-
vi.mock('../theme/marketplace-validate');
|
|
10
|
-
vi.mock('../theme/create');
|
|
11
|
-
vi.mock('../../lib/commonOpts');
|
|
12
|
-
const commandSpy = vi
|
|
13
|
-
.spyOn(yargs, 'command')
|
|
14
|
-
.mockReturnValue(yargs);
|
|
15
|
-
const demandCommandSpy = vi
|
|
16
|
-
.spyOn(yargs, 'demandCommand')
|
|
17
|
-
.mockReturnValue(yargs);
|
|
18
|
-
describe('commands/cms/theme', () => {
|
|
19
|
-
describe('command', () => {
|
|
20
|
-
it('should have the correct command structure', () => {
|
|
21
|
-
expect(themeCommands.command).toEqual(['theme', 'themes']);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
describe('describe', () => {
|
|
25
|
-
it('should provide a description', () => {
|
|
26
|
-
expect(themeCommands.describe).toBeDefined();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
describe('builder', () => {
|
|
30
|
-
beforeEach(() => {
|
|
31
|
-
commandSpy.mockClear();
|
|
32
|
-
demandCommandSpy.mockClear();
|
|
33
|
-
});
|
|
34
|
-
const subcommands = [
|
|
35
|
-
preview,
|
|
36
|
-
generateSelectors,
|
|
37
|
-
marketplaceValidate,
|
|
38
|
-
create,
|
|
39
|
-
];
|
|
40
|
-
it('should demand the command takes one positional argument', () => {
|
|
41
|
-
themeCommands.builder(yargs);
|
|
42
|
-
expect(demandCommandSpy).toHaveBeenCalledTimes(1);
|
|
43
|
-
expect(demandCommandSpy).toHaveBeenCalledWith(1, '');
|
|
44
|
-
});
|
|
45
|
-
it('should add the correct number of sub commands', () => {
|
|
46
|
-
themeCommands.builder(yargs);
|
|
47
|
-
expect(commandSpy).toHaveBeenCalledTimes(subcommands.length);
|
|
48
|
-
});
|
|
49
|
-
it.each(subcommands)('should attach the %s subcommand', module => {
|
|
50
|
-
themeCommands.builder(yargs);
|
|
51
|
-
expect(commandSpy).toHaveBeenCalledWith(module);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import * as uploadFolderLib from '@hubspot/local-dev-lib/cms/uploadFolder';
|
|
5
|
-
import * as fileMapperLib from '@hubspot/local-dev-lib/api/fileMapper';
|
|
6
|
-
import * as pathLib from '@hubspot/local-dev-lib/path';
|
|
7
|
-
import * as modulesLib from '@hubspot/local-dev-lib/cms/modules';
|
|
8
|
-
import * as ignoreRulesLib from '@hubspot/local-dev-lib/ignoreRules';
|
|
9
|
-
import * as themesLib from '@hubspot/local-dev-lib/cms/themes';
|
|
10
|
-
import * as configLib from '@hubspot/local-dev-lib/config';
|
|
11
|
-
import * as handleFieldsJSLib from '@hubspot/local-dev-lib/cms/handleFieldsJS';
|
|
12
|
-
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
13
|
-
import * as errorHandlers from '../../../lib/errorHandlers/index.js';
|
|
14
|
-
import * as commonOpts from '../../../lib/commonOpts.js';
|
|
15
|
-
import * as uploadPromptLib from '../../../lib/prompts/uploadPrompt.js';
|
|
16
|
-
import * as promptUtilsLib from '../../../lib/prompts/promptUtils.js';
|
|
17
|
-
import * as validationLib from '../../../lib/validation.js';
|
|
18
|
-
import * as usageTrackingLib from '../../../lib/usageTracking.js';
|
|
19
|
-
import * as uploadLib from '../../../lib/upload.js';
|
|
20
|
-
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
21
|
-
import uploadCommand from '../upload.js';
|
|
22
|
-
vi.mock('fs');
|
|
23
|
-
vi.mock('@hubspot/local-dev-lib/cms/uploadFolder');
|
|
24
|
-
vi.mock('@hubspot/local-dev-lib/api/fileMapper');
|
|
25
|
-
vi.mock('@hubspot/local-dev-lib/path');
|
|
26
|
-
vi.mock('@hubspot/local-dev-lib/cms/modules');
|
|
27
|
-
vi.mock('@hubspot/local-dev-lib/ignoreRules');
|
|
28
|
-
vi.mock('@hubspot/local-dev-lib/cms/themes');
|
|
29
|
-
vi.mock('@hubspot/local-dev-lib/config');
|
|
30
|
-
vi.mock('@hubspot/local-dev-lib/cms/handleFieldsJS');
|
|
31
|
-
vi.mock('../../../lib/errorHandlers/index.js');
|
|
32
|
-
vi.mock('../../../lib/commonOpts.js');
|
|
33
|
-
vi.mock('../../../lib/prompts/uploadPrompt.js');
|
|
34
|
-
vi.mock('../../../lib/prompts/promptUtils.js');
|
|
35
|
-
vi.mock('../../../lib/validation.js');
|
|
36
|
-
vi.mock('../../../lib/upload.js');
|
|
37
|
-
const uploadFolderSpy = vi.spyOn(uploadFolderLib, 'uploadFolder');
|
|
38
|
-
const uploadSpy = vi.spyOn(fileMapperLib, 'upload');
|
|
39
|
-
const deleteFileSpy = vi.spyOn(fileMapperLib, 'deleteFile');
|
|
40
|
-
const statSyncSpy = vi.spyOn(fs, 'statSync');
|
|
41
|
-
const validateSrcAndDestPathsSpy = vi.spyOn(modulesLib, 'validateSrcAndDestPaths');
|
|
42
|
-
const shouldIgnoreFileSpy = vi.spyOn(ignoreRulesLib, 'shouldIgnoreFile');
|
|
43
|
-
const isAllowedExtensionSpy = vi.spyOn(pathLib, 'isAllowedExtension');
|
|
44
|
-
const getCwdSpy = vi.spyOn(pathLib, 'getCwd');
|
|
45
|
-
const convertToUnixPathSpy = vi.spyOn(pathLib, 'convertToUnixPath');
|
|
46
|
-
const uploadPromptSpy = vi.spyOn(uploadPromptLib, 'uploadPrompt');
|
|
47
|
-
const confirmPromptSpy = vi.spyOn(promptUtilsLib, 'confirmPrompt');
|
|
48
|
-
const validateCmsPublishModeSpy = vi.spyOn(validationLib, 'validateCmsPublishMode');
|
|
49
|
-
const trackCommandUsageSpy = vi.spyOn(usageTrackingLib, 'trackCommandUsage');
|
|
50
|
-
const getUploadableFileListSpy = vi.spyOn(uploadLib, 'getUploadableFileList');
|
|
51
|
-
const getCmsPublishModeSpy = vi.spyOn(commonOpts, 'getCmsPublishMode');
|
|
52
|
-
const getThemePreviewUrlSpy = vi.spyOn(themesLib, 'getThemePreviewUrl');
|
|
53
|
-
const getThemeJSONPathSpy = vi.spyOn(themesLib, 'getThemeJSONPath');
|
|
54
|
-
const hasUploadErrorsSpy = vi.spyOn(uploadFolderLib, 'hasUploadErrors');
|
|
55
|
-
const processExitSpy = vi.spyOn(process, 'exit');
|
|
56
|
-
const logErrorSpy = vi.spyOn(errorHandlers, 'logError');
|
|
57
|
-
const getConfigAccountIfExistsSpy = vi.spyOn(configLib, 'getConfigAccountIfExists');
|
|
58
|
-
const isConvertableFieldJsSpy = vi.spyOn(handleFieldsJSLib, 'isConvertableFieldJs');
|
|
59
|
-
describe('commands/cms/upload', () => {
|
|
60
|
-
beforeEach(() => {
|
|
61
|
-
// @ts-expect-error Mock implementation
|
|
62
|
-
processExitSpy.mockImplementation(() => { });
|
|
63
|
-
getCwdSpy.mockReturnValue('/test/cwd');
|
|
64
|
-
convertToUnixPathSpy.mockImplementation(p => p.replace(/\\/g, '/'));
|
|
65
|
-
validateCmsPublishModeSpy.mockReturnValue(true);
|
|
66
|
-
getCmsPublishModeSpy.mockReturnValue('publish');
|
|
67
|
-
uploadPromptSpy.mockResolvedValue({ src: '', dest: '' });
|
|
68
|
-
validateSrcAndDestPathsSpy.mockResolvedValue([]);
|
|
69
|
-
getThemeJSONPathSpy.mockReturnValue(null);
|
|
70
|
-
getThemePreviewUrlSpy.mockReturnValue(undefined);
|
|
71
|
-
// Mock config to prevent reading actual config file in CI
|
|
72
|
-
getConfigAccountIfExistsSpy.mockReturnValue(undefined);
|
|
73
|
-
isConvertableFieldJsSpy.mockReturnValue(false);
|
|
74
|
-
});
|
|
75
|
-
describe('command', () => {
|
|
76
|
-
it('should have the correct command structure', () => {
|
|
77
|
-
expect(uploadCommand.command).toEqual('upload [src] [dest]');
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
describe('describe', () => {
|
|
81
|
-
it('should provide a description', () => {
|
|
82
|
-
expect(uploadCommand.describe).toBeDefined();
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
describe('builder', () => {
|
|
86
|
-
it('should support the correct options', () => {
|
|
87
|
-
const optionsSpy = vi.spyOn(yargs, 'option');
|
|
88
|
-
const positionalSpy = vi.spyOn(yargs, 'positional');
|
|
89
|
-
uploadCommand.builder(yargs);
|
|
90
|
-
expect(positionalSpy).toHaveBeenCalledWith('src', expect.objectContaining({ type: 'string' }));
|
|
91
|
-
expect(positionalSpy).toHaveBeenCalledWith('dest', expect.objectContaining({ type: 'string' }));
|
|
92
|
-
expect(optionsSpy).toHaveBeenCalledWith('field-options', expect.objectContaining({ type: 'array' }));
|
|
93
|
-
expect(optionsSpy).toHaveBeenCalledWith('save-output', expect.objectContaining({ type: 'boolean' }));
|
|
94
|
-
expect(optionsSpy).toHaveBeenCalledWith('convert-fields', expect.objectContaining({ type: 'boolean' }));
|
|
95
|
-
expect(optionsSpy).toHaveBeenCalledWith('clean', expect.objectContaining({ type: 'boolean' }));
|
|
96
|
-
expect(optionsSpy).toHaveBeenCalledWith('force', expect.objectContaining({ type: 'boolean' }));
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
describe('handler', () => {
|
|
100
|
-
let args;
|
|
101
|
-
beforeEach(() => {
|
|
102
|
-
args = {
|
|
103
|
-
src: 'test.js',
|
|
104
|
-
dest: '/dest/test.js',
|
|
105
|
-
derivedAccountId: 123456,
|
|
106
|
-
};
|
|
107
|
-
});
|
|
108
|
-
describe('validation', () => {
|
|
109
|
-
it('should exit if CMS publish mode validation fails', async () => {
|
|
110
|
-
validateCmsPublishModeSpy.mockReturnValue(false);
|
|
111
|
-
await uploadCommand.handler(args);
|
|
112
|
-
expect(validateCmsPublishModeSpy).toHaveBeenCalledWith(args);
|
|
113
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.WARNING);
|
|
114
|
-
});
|
|
115
|
-
it('should prompt for src and dest when not provided', async () => {
|
|
116
|
-
delete args.src;
|
|
117
|
-
delete args.dest;
|
|
118
|
-
uploadPromptSpy.mockResolvedValue({
|
|
119
|
-
src: 'prompted.js',
|
|
120
|
-
dest: '/prompted/dest.js',
|
|
121
|
-
});
|
|
122
|
-
statSyncSpy.mockReturnValue({
|
|
123
|
-
isFile: () => true,
|
|
124
|
-
isDirectory: () => false,
|
|
125
|
-
});
|
|
126
|
-
isAllowedExtensionSpy.mockReturnValue(true);
|
|
127
|
-
shouldIgnoreFileSpy.mockReturnValue(false);
|
|
128
|
-
// @ts-expect-error Mock return value doesn't need full type implementation
|
|
129
|
-
uploadSpy.mockResolvedValue({});
|
|
130
|
-
await uploadCommand.handler(args);
|
|
131
|
-
expect(uploadPromptSpy).toHaveBeenCalledWith(args);
|
|
132
|
-
expect(uploadSpy).toHaveBeenCalled();
|
|
133
|
-
});
|
|
134
|
-
it('should error if dest is not provided', async () => {
|
|
135
|
-
args.dest = '';
|
|
136
|
-
uploadPromptSpy.mockResolvedValue({ src: 'test.js', dest: '' });
|
|
137
|
-
await uploadCommand.handler(args);
|
|
138
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('destination'));
|
|
139
|
-
});
|
|
140
|
-
it('should error if src path is invalid', async () => {
|
|
141
|
-
statSyncSpy.mockImplementation(() => {
|
|
142
|
-
throw new Error('File not found');
|
|
143
|
-
});
|
|
144
|
-
await uploadCommand.handler(args);
|
|
145
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('path to a file or folder'));
|
|
146
|
-
});
|
|
147
|
-
it('should error if src path is not a file or directory', async () => {
|
|
148
|
-
statSyncSpy.mockReturnValue({
|
|
149
|
-
isFile: () => false,
|
|
150
|
-
isDirectory: () => false,
|
|
151
|
-
});
|
|
152
|
-
await uploadCommand.handler(args);
|
|
153
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('path to a file or folder'));
|
|
154
|
-
});
|
|
155
|
-
it('should exit if src/dest validation fails', async () => {
|
|
156
|
-
statSyncSpy.mockReturnValue({
|
|
157
|
-
isFile: () => true,
|
|
158
|
-
isDirectory: () => false,
|
|
159
|
-
});
|
|
160
|
-
validateSrcAndDestPathsSpy.mockResolvedValue([
|
|
161
|
-
{ id: '1', message: 'Invalid path' },
|
|
162
|
-
]);
|
|
163
|
-
await uploadCommand.handler(args);
|
|
164
|
-
expect(uiLogger.error).toHaveBeenCalledWith('Invalid path');
|
|
165
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.WARNING);
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
describe('file upload', () => {
|
|
169
|
-
beforeEach(() => {
|
|
170
|
-
statSyncSpy.mockReturnValue({
|
|
171
|
-
isFile: () => true,
|
|
172
|
-
isDirectory: () => false,
|
|
173
|
-
});
|
|
174
|
-
isAllowedExtensionSpy.mockReturnValue(true);
|
|
175
|
-
shouldIgnoreFileSpy.mockReturnValue(false);
|
|
176
|
-
});
|
|
177
|
-
it('should track command usage for file uploads', async () => {
|
|
178
|
-
// @ts-expect-error Mock return value doesn't need full type implementation
|
|
179
|
-
uploadSpy.mockResolvedValue({});
|
|
180
|
-
await uploadCommand.handler(args);
|
|
181
|
-
expect(trackCommandUsageSpy).toHaveBeenCalledWith('upload', { mode: 'publish', type: 'file' }, 123456);
|
|
182
|
-
});
|
|
183
|
-
it('should upload a file successfully', async () => {
|
|
184
|
-
// @ts-expect-error Mock return value doesn't need full type implementation
|
|
185
|
-
uploadSpy.mockResolvedValue({});
|
|
186
|
-
await uploadCommand.handler(args);
|
|
187
|
-
expect(uploadSpy).toHaveBeenCalledWith(123456, path.resolve('/test/cwd', 'test.js'), '/dest/test.js', expect.any(Object));
|
|
188
|
-
expect(uiLogger.success).toHaveBeenCalledWith(expect.stringMatching(/uploaded/i));
|
|
189
|
-
});
|
|
190
|
-
it('should error if file has disallowed extension', async () => {
|
|
191
|
-
isAllowedExtensionSpy.mockReturnValue(false);
|
|
192
|
-
await uploadCommand.handler(args);
|
|
193
|
-
expect(uploadSpy).not.toHaveBeenCalled();
|
|
194
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('path to a file or folder'));
|
|
195
|
-
});
|
|
196
|
-
it('should error if file is ignored', async () => {
|
|
197
|
-
shouldIgnoreFileSpy.mockReturnValue(true);
|
|
198
|
-
await uploadCommand.handler(args);
|
|
199
|
-
expect(uploadSpy).not.toHaveBeenCalled();
|
|
200
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('ignored'));
|
|
201
|
-
});
|
|
202
|
-
it('should handle upload errors', async () => {
|
|
203
|
-
vi.useFakeTimers();
|
|
204
|
-
const error = new Error('Upload failed');
|
|
205
|
-
uploadSpy.mockRejectedValue(error);
|
|
206
|
-
await uploadCommand.handler(args);
|
|
207
|
-
await vi.runAllTimersAsync();
|
|
208
|
-
expect(uiLogger.error).toHaveBeenCalled();
|
|
209
|
-
expect(logErrorSpy).toHaveBeenCalledWith(error, expect.any(errorHandlers.ApiErrorContext));
|
|
210
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.WARNING);
|
|
211
|
-
vi.useRealTimers();
|
|
212
|
-
});
|
|
213
|
-
it('should log theme preview URL if available', async () => {
|
|
214
|
-
getThemePreviewUrlSpy.mockReturnValue('http://preview.url');
|
|
215
|
-
// @ts-expect-error Mock return value doesn't need full type implementation
|
|
216
|
-
uploadSpy.mockResolvedValue({});
|
|
217
|
-
await uploadCommand.handler(args);
|
|
218
|
-
expect(getThemePreviewUrlSpy).toHaveBeenCalledWith('test.js', 123456);
|
|
219
|
-
expect(uiLogger.log).toHaveBeenCalledWith(expect.stringContaining('http://preview.url'));
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
describe('folder upload', () => {
|
|
223
|
-
beforeEach(() => {
|
|
224
|
-
statSyncSpy.mockReturnValue({
|
|
225
|
-
isFile: () => false,
|
|
226
|
-
isDirectory: () => true,
|
|
227
|
-
});
|
|
228
|
-
getUploadableFileListSpy.mockResolvedValue([]);
|
|
229
|
-
uploadFolderSpy.mockResolvedValue([]);
|
|
230
|
-
hasUploadErrorsSpy.mockReturnValue(false);
|
|
231
|
-
});
|
|
232
|
-
it('should track command usage for folder uploads', async () => {
|
|
233
|
-
await uploadCommand.handler(args);
|
|
234
|
-
expect(trackCommandUsageSpy).toHaveBeenCalledWith('upload', { mode: 'publish', type: 'folder' }, 123456);
|
|
235
|
-
});
|
|
236
|
-
it('should upload a folder successfully', async () => {
|
|
237
|
-
await uploadCommand.handler(args);
|
|
238
|
-
expect(uploadFolderSpy).toHaveBeenCalledWith(123456, path.resolve('/test/cwd', 'test.js'), '/dest/test.js', {}, expect.objectContaining({
|
|
239
|
-
convertFields: undefined,
|
|
240
|
-
saveOutput: undefined,
|
|
241
|
-
}), []);
|
|
242
|
-
expect(uiLogger.success).toHaveBeenCalledWith(expect.stringContaining('complete'));
|
|
243
|
-
});
|
|
244
|
-
it('should handle clean upload with confirmation', async () => {
|
|
245
|
-
args.clean = true;
|
|
246
|
-
confirmPromptSpy.mockResolvedValue(true);
|
|
247
|
-
// @ts-expect-error Mock return value doesn't need full type implementation
|
|
248
|
-
deleteFileSpy.mockResolvedValue({});
|
|
249
|
-
await uploadCommand.handler(args);
|
|
250
|
-
expect(confirmPromptSpy).toHaveBeenCalled();
|
|
251
|
-
expect(deleteFileSpy).toHaveBeenCalledWith(123456, '/dest/test.js');
|
|
252
|
-
// Check that log was called multiple times (upload message + cleaning message)
|
|
253
|
-
expect(uiLogger.log).toHaveBeenCalled();
|
|
254
|
-
});
|
|
255
|
-
it('should skip clean upload if not confirmed', async () => {
|
|
256
|
-
args.clean = true;
|
|
257
|
-
confirmPromptSpy.mockResolvedValue(false);
|
|
258
|
-
await uploadCommand.handler(args);
|
|
259
|
-
expect(deleteFileSpy).not.toHaveBeenCalled();
|
|
260
|
-
});
|
|
261
|
-
it('should force clean upload without confirmation', async () => {
|
|
262
|
-
args.clean = true;
|
|
263
|
-
args.force = true;
|
|
264
|
-
// @ts-expect-error Mock return value doesn't need full type implementation
|
|
265
|
-
deleteFileSpy.mockResolvedValue({});
|
|
266
|
-
await uploadCommand.handler(args);
|
|
267
|
-
expect(confirmPromptSpy).not.toHaveBeenCalled();
|
|
268
|
-
expect(deleteFileSpy).toHaveBeenCalledWith(123456, '/dest/test.js');
|
|
269
|
-
});
|
|
270
|
-
it('should handle delete errors during clean upload', async () => {
|
|
271
|
-
args.clean = true;
|
|
272
|
-
args.force = true;
|
|
273
|
-
const error = new Error('Delete failed');
|
|
274
|
-
deleteFileSpy.mockRejectedValue(error);
|
|
275
|
-
await uploadCommand.handler(args);
|
|
276
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('Deleting'));
|
|
277
|
-
});
|
|
278
|
-
it('should error if folder upload has errors', async () => {
|
|
279
|
-
hasUploadErrorsSpy.mockReturnValue(true);
|
|
280
|
-
await uploadCommand.handler(args);
|
|
281
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('failed'));
|
|
282
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.WARNING);
|
|
283
|
-
});
|
|
284
|
-
it('should handle folder upload errors', async () => {
|
|
285
|
-
vi.useFakeTimers();
|
|
286
|
-
const error = new Error('Folder upload failed');
|
|
287
|
-
uploadFolderSpy.mockRejectedValue(error);
|
|
288
|
-
await uploadCommand.handler(args);
|
|
289
|
-
await vi.runAllTimersAsync();
|
|
290
|
-
expect(uiLogger.error).toHaveBeenCalled();
|
|
291
|
-
expect(logErrorSpy).toHaveBeenCalledWith(error, {
|
|
292
|
-
accountId: 123456,
|
|
293
|
-
});
|
|
294
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.WARNING);
|
|
295
|
-
vi.useRealTimers();
|
|
296
|
-
});
|
|
297
|
-
it('should pass convertFields option to uploadFolder', async () => {
|
|
298
|
-
args.convertFields = true;
|
|
299
|
-
await uploadCommand.handler(args);
|
|
300
|
-
expect(uploadFolderSpy).toHaveBeenCalledWith(123456, expect.any(String), expect.any(String), {}, expect.objectContaining({
|
|
301
|
-
convertFields: true,
|
|
302
|
-
}), expect.any(Array));
|
|
303
|
-
});
|
|
304
|
-
it('should generate uploadable file list with convertFields', async () => {
|
|
305
|
-
args.convertFields = true;
|
|
306
|
-
getUploadableFileListSpy.mockResolvedValue(['file1.js', 'file2.js']);
|
|
307
|
-
await uploadCommand.handler(args);
|
|
308
|
-
expect(getUploadableFileListSpy).toHaveBeenCalledWith(path.resolve('/test/cwd', 'test.js'), true);
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
|
-
});
|
|
312
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { AxiosError } from 'axios';
|
|
5
|
-
import * as watchLib from '@hubspot/local-dev-lib/cms/watch';
|
|
6
|
-
import * as pathLib from '@hubspot/local-dev-lib/path';
|
|
7
|
-
import * as configLib from '@hubspot/local-dev-lib/config';
|
|
8
|
-
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
9
|
-
import * as commonOpts from '../../../lib/commonOpts.js';
|
|
10
|
-
import * as uploadPromptLib from '../../../lib/prompts/uploadPrompt.js';
|
|
11
|
-
import * as validationLib from '../../../lib/validation.js';
|
|
12
|
-
import * as usageTrackingLib from '../../../lib/usageTracking.js';
|
|
13
|
-
import * as uploadLib from '../../../lib/upload.js';
|
|
14
|
-
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
15
|
-
import watchCommand from '../watch.js';
|
|
16
|
-
vi.mock('fs');
|
|
17
|
-
vi.mock('@hubspot/local-dev-lib/cms/watch');
|
|
18
|
-
vi.mock('@hubspot/local-dev-lib/path');
|
|
19
|
-
vi.mock('@hubspot/local-dev-lib/config');
|
|
20
|
-
vi.mock('../../../lib/commonOpts.js');
|
|
21
|
-
vi.mock('../../../lib/prompts/uploadPrompt.js');
|
|
22
|
-
vi.mock('../../../lib/validation.js');
|
|
23
|
-
vi.mock('../../../lib/upload.js');
|
|
24
|
-
const watchSpy = vi.spyOn(watchLib, 'watch');
|
|
25
|
-
const statSyncSpy = vi.spyOn(fs, 'statSync');
|
|
26
|
-
const getCwdSpy = vi.spyOn(pathLib, 'getCwd');
|
|
27
|
-
const uploadPromptSpy = vi.spyOn(uploadPromptLib, 'uploadPrompt');
|
|
28
|
-
const validateCmsPublishModeSpy = vi.spyOn(validationLib, 'validateCmsPublishMode');
|
|
29
|
-
const getCmsPublishModeSpy = vi.spyOn(commonOpts, 'getCmsPublishMode');
|
|
30
|
-
const trackCommandUsageSpy = vi.spyOn(usageTrackingLib, 'trackCommandUsage');
|
|
31
|
-
const getUploadableFileListSpy = vi.spyOn(uploadLib, 'getUploadableFileList');
|
|
32
|
-
const processExitSpy = vi.spyOn(process, 'exit');
|
|
33
|
-
const getConfigAccountIfExistsSpy = vi.spyOn(configLib, 'getConfigAccountIfExists');
|
|
34
|
-
describe('commands/cms/watch', () => {
|
|
35
|
-
beforeEach(() => {
|
|
36
|
-
// @ts-expect-error Mock implementation
|
|
37
|
-
processExitSpy.mockImplementation(() => { });
|
|
38
|
-
getCwdSpy.mockReturnValue('/test/cwd');
|
|
39
|
-
validateCmsPublishModeSpy.mockReturnValue(true);
|
|
40
|
-
getCmsPublishModeSpy.mockReturnValue('publish');
|
|
41
|
-
uploadPromptSpy.mockResolvedValue({ src: '', dest: '' });
|
|
42
|
-
// @ts-expect-error Mock return value doesn't need full type implementation
|
|
43
|
-
watchSpy.mockImplementation(() => ({}));
|
|
44
|
-
getUploadableFileListSpy.mockResolvedValue([]);
|
|
45
|
-
// Mock config to prevent reading actual config file in CI
|
|
46
|
-
getConfigAccountIfExistsSpy.mockReturnValue(undefined);
|
|
47
|
-
});
|
|
48
|
-
describe('command', () => {
|
|
49
|
-
it('should have the correct command structure', () => {
|
|
50
|
-
expect(watchCommand.command).toEqual('watch [src] [dest]');
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
describe('describe', () => {
|
|
54
|
-
it('should provide a description', () => {
|
|
55
|
-
expect(watchCommand.describe).toBeDefined();
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
describe('builder', () => {
|
|
59
|
-
it('should support the correct options', () => {
|
|
60
|
-
const positionalSpy = vi.spyOn(yargs, 'positional');
|
|
61
|
-
const optionSpy = vi.spyOn(yargs, 'option');
|
|
62
|
-
watchCommand.builder(yargs);
|
|
63
|
-
expect(positionalSpy).toHaveBeenCalledWith('src', expect.objectContaining({ type: 'string' }));
|
|
64
|
-
expect(positionalSpy).toHaveBeenCalledWith('dest', expect.objectContaining({ type: 'string' }));
|
|
65
|
-
expect(optionSpy).toHaveBeenCalledWith('remove', expect.objectContaining({ type: 'boolean', alias: 'r' }));
|
|
66
|
-
expect(optionSpy).toHaveBeenCalledWith('initial-upload', expect.objectContaining({ type: 'boolean', alias: 'i' }));
|
|
67
|
-
expect(optionSpy).toHaveBeenCalledWith('notify', expect.objectContaining({ type: 'string', alias: 'n' }));
|
|
68
|
-
expect(optionSpy).toHaveBeenCalledWith('convert-fields', expect.objectContaining({ type: 'boolean' }));
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
describe('handler', () => {
|
|
72
|
-
let args;
|
|
73
|
-
beforeEach(() => {
|
|
74
|
-
args = {
|
|
75
|
-
src: 'src',
|
|
76
|
-
dest: '/dest',
|
|
77
|
-
derivedAccountId: 123456,
|
|
78
|
-
remove: false,
|
|
79
|
-
initialUpload: false,
|
|
80
|
-
};
|
|
81
|
-
statSyncSpy.mockReturnValue({
|
|
82
|
-
isFile: () => false,
|
|
83
|
-
isDirectory: () => true,
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
describe('validation', () => {
|
|
87
|
-
it('should exit if CMS publish mode validation fails', async () => {
|
|
88
|
-
validateCmsPublishModeSpy.mockReturnValue(false);
|
|
89
|
-
await watchCommand.handler(args);
|
|
90
|
-
expect(validateCmsPublishModeSpy).toHaveBeenCalledWith(args);
|
|
91
|
-
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
92
|
-
});
|
|
93
|
-
it('should prompt for src and dest when not provided', async () => {
|
|
94
|
-
delete args.src;
|
|
95
|
-
delete args.dest;
|
|
96
|
-
uploadPromptSpy.mockResolvedValue({
|
|
97
|
-
src: 'prompted-src',
|
|
98
|
-
dest: '/prompted-dest',
|
|
99
|
-
});
|
|
100
|
-
await watchCommand.handler(args);
|
|
101
|
-
expect(uploadPromptSpy).toHaveBeenCalledWith(args);
|
|
102
|
-
});
|
|
103
|
-
it('should error if src path is invalid', async () => {
|
|
104
|
-
statSyncSpy.mockImplementation(() => {
|
|
105
|
-
throw new Error('File not found');
|
|
106
|
-
});
|
|
107
|
-
await watchCommand.handler(args);
|
|
108
|
-
expect(uiLogger.log).toHaveBeenCalledWith(expect.stringContaining('path to a directory'));
|
|
109
|
-
expect(watchSpy).not.toHaveBeenCalled();
|
|
110
|
-
});
|
|
111
|
-
it('should error if src path is not a directory', async () => {
|
|
112
|
-
statSyncSpy.mockReturnValue({
|
|
113
|
-
isFile: () => true,
|
|
114
|
-
isDirectory: () => false,
|
|
115
|
-
});
|
|
116
|
-
await watchCommand.handler(args);
|
|
117
|
-
expect(uiLogger.log).toHaveBeenCalledWith(expect.stringContaining('path to a directory'));
|
|
118
|
-
expect(watchSpy).not.toHaveBeenCalled();
|
|
119
|
-
});
|
|
120
|
-
it('should error if dest is not provided', async () => {
|
|
121
|
-
args.dest = '';
|
|
122
|
-
uploadPromptSpy.mockResolvedValue({ src: 'src', dest: '' });
|
|
123
|
-
await watchCommand.handler(args);
|
|
124
|
-
expect(uiLogger.log).toHaveBeenCalledWith(expect.stringContaining('destination'));
|
|
125
|
-
expect(watchSpy).not.toHaveBeenCalled();
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
describe('watch execution', () => {
|
|
129
|
-
it('should track command usage', async () => {
|
|
130
|
-
await watchCommand.handler(args);
|
|
131
|
-
expect(trackCommandUsageSpy).toHaveBeenCalledWith('watch', { mode: 'publish' }, 123456);
|
|
132
|
-
});
|
|
133
|
-
it('should start watching without initial upload by default', async () => {
|
|
134
|
-
await watchCommand.handler(args);
|
|
135
|
-
expect(getUploadableFileListSpy).not.toHaveBeenCalled();
|
|
136
|
-
expect(watchSpy).toHaveBeenCalledWith(123456, path.resolve('/test/cwd', 'src'), '/dest', expect.objectContaining({
|
|
137
|
-
cmsPublishMode: 'publish',
|
|
138
|
-
remove: false,
|
|
139
|
-
disableInitial: true,
|
|
140
|
-
}), null, expect.any(Function), undefined, expect.any(Function));
|
|
141
|
-
});
|
|
142
|
-
it('should generate uploadable file list when initialUpload is true', async () => {
|
|
143
|
-
args.initialUpload = true;
|
|
144
|
-
getUploadableFileListSpy.mockResolvedValue(['file1.js', 'file2.js']);
|
|
145
|
-
await watchCommand.handler(args);
|
|
146
|
-
expect(getUploadableFileListSpy).toHaveBeenCalledWith(path.resolve('/test/cwd', 'src'), undefined);
|
|
147
|
-
expect(watchSpy).toHaveBeenCalledWith(123456, expect.any(String), expect.any(String), expect.objectContaining({
|
|
148
|
-
disableInitial: false,
|
|
149
|
-
filePaths: ['file1.js', 'file2.js'],
|
|
150
|
-
}), null, expect.any(Function), undefined, expect.any(Function));
|
|
151
|
-
});
|
|
152
|
-
it('should pass remove option to watch', async () => {
|
|
153
|
-
args.remove = true;
|
|
154
|
-
await watchCommand.handler(args);
|
|
155
|
-
expect(watchSpy).toHaveBeenCalledWith(123456, expect.any(String), expect.any(String), expect.objectContaining({
|
|
156
|
-
remove: true,
|
|
157
|
-
}), null, expect.any(Function), undefined, expect.any(Function));
|
|
158
|
-
});
|
|
159
|
-
it('should pass notify option to watch', async () => {
|
|
160
|
-
args.notify = 'http://notify.url';
|
|
161
|
-
await watchCommand.handler(args);
|
|
162
|
-
expect(watchSpy).toHaveBeenCalledWith(123456, expect.any(String), expect.any(String), expect.objectContaining({
|
|
163
|
-
notify: 'http://notify.url',
|
|
164
|
-
}), null, expect.any(Function), undefined, expect.any(Function));
|
|
165
|
-
});
|
|
166
|
-
it('should pass convertFields to getUploadableFileList', async () => {
|
|
167
|
-
args.initialUpload = true;
|
|
168
|
-
args.convertFields = true;
|
|
169
|
-
await watchCommand.handler(args);
|
|
170
|
-
expect(getUploadableFileListSpy).toHaveBeenCalledWith(expect.any(String), true);
|
|
171
|
-
});
|
|
172
|
-
it('should pass command options to watch', async () => {
|
|
173
|
-
args.saveOutput = true;
|
|
174
|
-
args.fieldOptions = ['option1'];
|
|
175
|
-
await watchCommand.handler(args);
|
|
176
|
-
expect(watchSpy).toHaveBeenCalledWith(123456, expect.any(String), expect.any(String), expect.objectContaining({
|
|
177
|
-
commandOptions: expect.objectContaining({
|
|
178
|
-
saveOutput: true,
|
|
179
|
-
fieldOptions: ['option1'],
|
|
180
|
-
}),
|
|
181
|
-
}), null, expect.any(Function), undefined, expect.any(Function));
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
describe('error handlers', () => {
|
|
185
|
-
it('should provide error handler for folder errors', async () => {
|
|
186
|
-
await watchCommand.handler(args);
|
|
187
|
-
const folderErrorHandler = watchSpy.mock.calls[0][5];
|
|
188
|
-
const error = new AxiosError('Folder error');
|
|
189
|
-
// @ts-expect-error Axios version mismatch between test and implementation
|
|
190
|
-
folderErrorHandler?.(error);
|
|
191
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('failures'));
|
|
192
|
-
});
|
|
193
|
-
it('should provide error handler factory for file errors', async () => {
|
|
194
|
-
await watchCommand.handler(args);
|
|
195
|
-
const fileErrorHandlerFactory = watchSpy.mock.calls[0][7];
|
|
196
|
-
const fileErrorHandler = fileErrorHandlerFactory?.('test.js', '/dest/test.js', 123456);
|
|
197
|
-
const error = new AxiosError('File error');
|
|
198
|
-
// @ts-expect-error Axios version mismatch between test and implementation
|
|
199
|
-
fileErrorHandler?.(error);
|
|
200
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('test.js'));
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|