movehat 0.1.9 → 0.2.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/README.md +2 -2
- package/dist/__tests__/deployContract.test.d.ts +2 -0
- package/dist/__tests__/deployContract.test.d.ts.map +1 -0
- package/dist/__tests__/deployContract.test.js +368 -0
- package/dist/__tests__/deployContract.test.js.map +1 -0
- package/dist/__tests__/errors.test.d.ts +2 -0
- package/dist/__tests__/errors.test.d.ts.map +1 -0
- package/dist/__tests__/errors.test.js +46 -0
- package/dist/__tests__/errors.test.js.map +1 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts +24 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts.map +1 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.js +82 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.js.map +1 -0
- package/dist/__tests__/fork/api.test.d.ts +2 -0
- package/dist/__tests__/fork/api.test.d.ts.map +1 -0
- package/dist/__tests__/fork/api.test.js +110 -0
- package/dist/__tests__/fork/api.test.js.map +1 -0
- package/dist/__tests__/harness/Harness.createLive.test.d.ts +2 -0
- package/dist/__tests__/harness/Harness.createLive.test.d.ts.map +1 -0
- package/dist/__tests__/harness/Harness.createLive.test.js +53 -0
- package/dist/__tests__/harness/Harness.createLive.test.js.map +1 -0
- package/dist/__tests__/harness/Harness.proxy.test.d.ts +2 -0
- package/dist/__tests__/harness/Harness.proxy.test.d.ts.map +1 -0
- package/dist/__tests__/harness/Harness.proxy.test.js +93 -0
- package/dist/__tests__/harness/Harness.proxy.test.js.map +1 -0
- package/dist/__tests__/harness/_fixture.d.ts +54 -0
- package/dist/__tests__/harness/_fixture.d.ts.map +1 -0
- package/dist/__tests__/harness/_fixture.js +69 -0
- package/dist/__tests__/harness/_fixture.js.map +1 -0
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts +2 -0
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts.map +1 -0
- package/dist/__tests__/harness/codeObject.deploy.test.js +288 -0
- package/dist/__tests__/harness/codeObject.deploy.test.js.map +1 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts +2 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts.map +1 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.js +138 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.js.map +1 -0
- package/dist/__tests__/harness/script.test.d.ts +2 -0
- package/dist/__tests__/harness/script.test.d.ts.map +1 -0
- package/dist/__tests__/harness/script.test.js +219 -0
- package/dist/__tests__/harness/script.test.js.map +1 -0
- package/dist/__tests__/harness/view.test.d.ts +2 -0
- package/dist/__tests__/harness/view.test.d.ts.map +1 -0
- package/dist/__tests__/harness/view.test.js +92 -0
- package/dist/__tests__/harness/view.test.js.map +1 -0
- package/dist/__tests__/runtime.test.d.ts +2 -0
- package/dist/__tests__/runtime.test.d.ts.map +1 -0
- package/dist/__tests__/runtime.test.js +141 -0
- package/dist/__tests__/runtime.test.js.map +1 -0
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/__tests__/compile.test.d.ts +2 -0
- package/dist/commands/__tests__/compile.test.d.ts.map +1 -0
- package/dist/commands/__tests__/compile.test.js +351 -0
- package/dist/commands/__tests__/compile.test.js.map +1 -0
- package/dist/commands/__tests__/init.test.d.ts +2 -0
- package/dist/commands/__tests__/init.test.d.ts.map +1 -0
- package/dist/commands/__tests__/init.test.js +101 -0
- package/dist/commands/__tests__/init.test.js.map +1 -0
- package/dist/commands/__tests__/run.test.d.ts +2 -0
- package/dist/commands/__tests__/run.test.d.ts.map +1 -0
- package/dist/commands/__tests__/run.test.js +166 -0
- package/dist/commands/__tests__/run.test.js.map +1 -0
- package/dist/commands/__tests__/test-move.test.d.ts +2 -0
- package/dist/commands/__tests__/test-move.test.d.ts.map +1 -0
- package/dist/commands/__tests__/test-move.test.js +59 -0
- package/dist/commands/__tests__/test-move.test.js.map +1 -0
- package/dist/commands/__tests__/test.test.d.ts +2 -0
- package/dist/commands/__tests__/test.test.d.ts.map +1 -0
- package/dist/commands/__tests__/test.test.js +168 -0
- package/dist/commands/__tests__/test.test.js.map +1 -0
- package/dist/commands/__tests__/update.test.d.ts +2 -0
- package/dist/commands/__tests__/update.test.d.ts.map +1 -0
- package/dist/commands/__tests__/update.test.js +176 -0
- package/dist/commands/__tests__/update.test.js.map +1 -0
- package/dist/commands/compile.d.ts +7 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +150 -33
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/fork/__tests__/create.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/create.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/create.test.js +108 -0
- package/dist/commands/fork/__tests__/create.test.js.map +1 -0
- package/dist/commands/fork/__tests__/fund.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/fund.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/fund.test.js +72 -0
- package/dist/commands/fork/__tests__/fund.test.js.map +1 -0
- package/dist/commands/fork/__tests__/list.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/list.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/list.test.js +119 -0
- package/dist/commands/fork/__tests__/list.test.js.map +1 -0
- package/dist/commands/fork/__tests__/serve.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/serve.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/serve.test.js +97 -0
- package/dist/commands/fork/__tests__/serve.test.js.map +1 -0
- package/dist/commands/fork/__tests__/view-resource.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/view-resource.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/view-resource.test.js +77 -0
- package/dist/commands/fork/__tests__/view-resource.test.js.map +1 -0
- package/dist/commands/fork/create.d.ts +1 -1
- package/dist/commands/fork/create.d.ts.map +1 -1
- package/dist/commands/fork/create.js +3 -2
- package/dist/commands/fork/create.js.map +1 -1
- package/dist/commands/fork/fund.d.ts.map +1 -1
- package/dist/commands/fork/fund.js +15 -8
- package/dist/commands/fork/fund.js.map +1 -1
- package/dist/commands/fork/list.d.ts.map +1 -1
- package/dist/commands/fork/list.js +2 -1
- package/dist/commands/fork/list.js.map +1 -1
- package/dist/commands/fork/serve.d.ts +1 -0
- package/dist/commands/fork/serve.d.ts.map +1 -1
- package/dist/commands/fork/serve.js +4 -2
- package/dist/commands/fork/serve.js.map +1 -1
- package/dist/commands/fork/view-resource.d.ts.map +1 -1
- package/dist/commands/fork/view-resource.js +10 -5
- package/dist/commands/fork/view-resource.js.map +1 -1
- package/dist/commands/run.d.ts +15 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +50 -27
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/test-move.d.ts.map +1 -1
- package/dist/commands/test-move.js +3 -2
- package/dist/commands/test-move.js.map +1 -1
- package/dist/commands/test.js +52 -46
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +15 -13
- package/dist/commands/update.js.map +1 -1
- package/dist/core/AccountManager.d.ts +1 -1
- package/dist/core/AccountManager.d.ts.map +1 -1
- package/dist/core/AccountManager.js +20 -7
- package/dist/core/AccountManager.js.map +1 -1
- package/dist/core/Publisher.d.ts +31 -0
- package/dist/core/Publisher.d.ts.map +1 -0
- package/dist/core/Publisher.js +248 -0
- package/dist/core/Publisher.js.map +1 -0
- package/dist/core/__tests__/AccountManager.test.d.ts +2 -0
- package/dist/core/__tests__/AccountManager.test.d.ts.map +1 -0
- package/dist/core/__tests__/AccountManager.test.js +239 -0
- package/dist/core/__tests__/AccountManager.test.js.map +1 -0
- package/dist/core/__tests__/config.test.d.ts +2 -0
- package/dist/core/__tests__/config.test.d.ts.map +1 -0
- package/dist/core/__tests__/config.test.js +311 -0
- package/dist/core/__tests__/config.test.js.map +1 -0
- package/dist/core/__tests__/deployments.test.d.ts +2 -0
- package/dist/core/__tests__/deployments.test.d.ts.map +1 -0
- package/dist/core/__tests__/deployments.test.js +201 -0
- package/dist/core/__tests__/deployments.test.js.map +1 -0
- package/dist/core/__tests__/shell.test.d.ts +2 -0
- package/dist/core/__tests__/shell.test.d.ts.map +1 -0
- package/dist/core/__tests__/shell.test.js +107 -0
- package/dist/core/__tests__/shell.test.js.map +1 -0
- package/dist/core/config.d.ts +13 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +80 -11
- package/dist/core/config.js.map +1 -1
- package/dist/core/contract.d.ts +1 -1
- package/dist/core/contract.d.ts.map +1 -1
- package/dist/core/contract.js +15 -4
- package/dist/core/contract.js.map +1 -1
- package/dist/core/deployments.d.ts +2 -2
- package/dist/core/deployments.d.ts.map +1 -1
- package/dist/core/deployments.js +8 -6
- package/dist/core/deployments.js.map +1 -1
- package/dist/core/movementProfile.d.ts +34 -0
- package/dist/core/movementProfile.d.ts.map +1 -0
- package/dist/core/movementProfile.js +150 -0
- package/dist/core/movementProfile.js.map +1 -0
- package/dist/core/shell.d.ts +23 -7
- package/dist/core/shell.d.ts.map +1 -1
- package/dist/core/shell.js +32 -14
- package/dist/core/shell.js.map +1 -1
- package/dist/errors.d.ts +35 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +54 -0
- package/dist/errors.js.map +1 -1
- package/dist/fork/__tests__/manager.test.d.ts +2 -0
- package/dist/fork/__tests__/manager.test.d.ts.map +1 -0
- package/dist/fork/__tests__/manager.test.js +309 -0
- package/dist/fork/__tests__/manager.test.js.map +1 -0
- package/dist/fork/__tests__/server.test.d.ts +2 -0
- package/dist/fork/__tests__/server.test.d.ts.map +1 -0
- package/dist/fork/__tests__/server.test.js +54 -0
- package/dist/fork/__tests__/server.test.js.map +1 -0
- package/dist/fork/__tests__/storage.test.d.ts +2 -0
- package/dist/fork/__tests__/storage.test.d.ts.map +1 -0
- package/dist/fork/__tests__/storage.test.js +222 -0
- package/dist/fork/__tests__/storage.test.js.map +1 -0
- package/dist/fork/__tests__/test.test.d.ts +2 -0
- package/dist/fork/__tests__/test.test.d.ts.map +1 -0
- package/dist/fork/__tests__/test.test.js +81 -0
- package/dist/fork/__tests__/test.test.js.map +1 -0
- package/dist/fork/api.d.ts +14 -3
- package/dist/fork/api.d.ts.map +1 -1
- package/dist/fork/api.js +25 -14
- package/dist/fork/api.js.map +1 -1
- package/dist/fork/manager.d.ts +23 -9
- package/dist/fork/manager.d.ts.map +1 -1
- package/dist/fork/manager.js +79 -36
- package/dist/fork/manager.js.map +1 -1
- package/dist/fork/server.d.ts +11 -3
- package/dist/fork/server.d.ts.map +1 -1
- package/dist/fork/server.js +45 -13
- package/dist/fork/server.js.map +1 -1
- package/dist/fork/storage.d.ts +4 -4
- package/dist/fork/storage.d.ts.map +1 -1
- package/dist/fork/storage.js +7 -9
- package/dist/fork/storage.js.map +1 -1
- package/dist/fork/test.d.ts +13 -4
- package/dist/fork/test.d.ts.map +1 -1
- package/dist/fork/test.js +36 -27
- package/dist/fork/test.js.map +1 -1
- package/dist/harness/Harness.d.ts +124 -0
- package/dist/harness/Harness.d.ts.map +1 -0
- package/dist/harness/Harness.js +193 -0
- package/dist/harness/Harness.js.map +1 -0
- package/dist/harness/codeObject.d.ts +31 -0
- package/dist/harness/codeObject.d.ts.map +1 -0
- package/dist/harness/codeObject.js +271 -0
- package/dist/harness/codeObject.js.map +1 -0
- package/dist/harness/errors.d.ts +14 -0
- package/dist/harness/errors.d.ts.map +1 -0
- package/dist/harness/errors.js +22 -0
- package/dist/harness/errors.js.map +1 -0
- package/dist/harness/index.d.ts +4 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +3 -0
- package/dist/harness/index.js.map +1 -0
- package/dist/harness/proxy.d.ts +7 -0
- package/dist/harness/proxy.d.ts.map +1 -0
- package/dist/harness/proxy.js +36 -0
- package/dist/harness/proxy.js.map +1 -0
- package/dist/harness/script.d.ts +21 -0
- package/dist/harness/script.d.ts.map +1 -0
- package/dist/harness/script.js +155 -0
- package/dist/harness/script.js.map +1 -0
- package/dist/harness/view.d.ts +22 -0
- package/dist/harness/view.d.ts.map +1 -0
- package/dist/harness/view.js +28 -0
- package/dist/harness/view.js.map +1 -0
- package/dist/helpers/__tests__/semver-utils.test.d.ts +2 -0
- package/dist/helpers/__tests__/semver-utils.test.d.ts.map +1 -0
- package/dist/helpers/__tests__/semver-utils.test.js +103 -0
- package/dist/helpers/__tests__/semver-utils.test.js.map +1 -0
- package/dist/helpers/index.d.ts +3 -2
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +2 -2
- package/dist/helpers/index.js.map +1 -1
- package/dist/helpers/move-tests.d.ts +3 -3
- package/dist/helpers/move-tests.d.ts.map +1 -1
- package/dist/helpers/move-tests.js +21 -20
- package/dist/helpers/move-tests.js.map +1 -1
- package/dist/helpers/npm-registry.d.ts.map +1 -1
- package/dist/helpers/npm-registry.js +1 -3
- package/dist/helpers/npm-registry.js.map +1 -1
- package/dist/helpers/semver-utils.d.ts.map +1 -1
- package/dist/helpers/semver-utils.js +4 -3
- package/dist/helpers/semver-utils.js.map +1 -1
- package/dist/helpers/setup.d.ts.map +1 -1
- package/dist/helpers/setup.js +6 -4
- package/dist/helpers/setup.js.map +1 -1
- package/dist/helpers/setupLocalTesting.d.ts +32 -27
- package/dist/helpers/setupLocalTesting.d.ts.map +1 -1
- package/dist/helpers/setupLocalTesting.js +179 -180
- package/dist/helpers/setupLocalTesting.js.map +1 -1
- package/dist/helpers/testFixtures.d.ts +19 -53
- package/dist/helpers/testFixtures.d.ts.map +1 -1
- package/dist/helpers/testFixtures.js +89 -107
- package/dist/helpers/testFixtures.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/node/LocalNodeManager.d.ts +9 -1
- package/dist/node/LocalNodeManager.d.ts.map +1 -1
- package/dist/node/LocalNodeManager.js +75 -58
- package/dist/node/LocalNodeManager.js.map +1 -1
- package/dist/node/__tests__/LocalNodeManager.test.d.ts +2 -0
- package/dist/node/__tests__/LocalNodeManager.test.d.ts.map +1 -0
- package/dist/node/__tests__/LocalNodeManager.test.js +349 -0
- package/dist/node/__tests__/LocalNodeManager.test.js.map +1 -0
- package/dist/runtime.d.ts +12 -15
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +28 -239
- package/dist/runtime.js.map +1 -1
- package/dist/templates/README.md +1 -1
- package/dist/templates/movehat.config.ts +10 -0
- package/dist/templates/package.json +2 -1
- package/dist/templates/scripts/deploy-counter.ts +46 -38
- package/dist/templates/tests/Counter.test.ts +39 -51
- package/dist/templates/types/movehat.d.ts +6 -9
- package/dist/types/config.d.ts +8 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/fork.d.ts +7 -1
- package/dist/types/fork.d.ts.map +1 -1
- package/dist/types/harness.d.ts +166 -0
- package/dist/types/harness.d.ts.map +1 -0
- package/dist/types/harness.js +2 -0
- package/dist/types/harness.js.map +1 -0
- package/dist/types/runtime.d.ts +7 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/ui/__tests__/colors.test.d.ts +2 -0
- package/dist/ui/__tests__/colors.test.d.ts.map +1 -0
- package/dist/ui/__tests__/colors.test.js +127 -0
- package/dist/ui/__tests__/colors.test.js.map +1 -0
- package/dist/ui/colors.d.ts.map +1 -1
- package/dist/ui/colors.js +6 -2
- package/dist/ui/colors.js.map +1 -1
- package/dist/ui/logger.d.ts +17 -0
- package/dist/ui/logger.d.ts.map +1 -1
- package/dist/ui/logger.js +22 -0
- package/dist/ui/logger.js.map +1 -1
- package/dist/ui/symbols.d.ts +1 -0
- package/dist/ui/symbols.d.ts.map +1 -1
- package/dist/ui/symbols.js +7 -1
- package/dist/ui/symbols.js.map +1 -1
- package/dist/utils/__tests__/address.test.d.ts +2 -0
- package/dist/utils/__tests__/address.test.d.ts.map +1 -0
- package/dist/utils/__tests__/address.test.js +70 -0
- package/dist/utils/__tests__/address.test.js.map +1 -0
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts +2 -0
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts.map +1 -0
- package/dist/utils/__tests__/childProcessAdapter.test.js +217 -0
- package/dist/utils/__tests__/childProcessAdapter.test.js.map +1 -0
- package/dist/utils/__tests__/runCli.test.d.ts +2 -0
- package/dist/utils/__tests__/runCli.test.d.ts.map +1 -0
- package/dist/utils/__tests__/runCli.test.js +187 -0
- package/dist/utils/__tests__/runCli.test.js.map +1 -0
- package/dist/utils/address.d.ts +33 -0
- package/dist/utils/address.d.ts.map +1 -0
- package/dist/utils/address.js +52 -0
- package/dist/utils/address.js.map +1 -0
- package/dist/utils/childProcessAdapter.d.ts +93 -0
- package/dist/utils/childProcessAdapter.d.ts.map +1 -0
- package/dist/utils/childProcessAdapter.js +109 -0
- package/dist/utils/childProcessAdapter.js.map +1 -0
- package/dist/utils/parseCliOutput.d.ts +20 -0
- package/dist/utils/parseCliOutput.d.ts.map +1 -0
- package/dist/utils/parseCliOutput.js +26 -0
- package/dist/utils/parseCliOutput.js.map +1 -0
- package/dist/utils/redact.d.ts +15 -0
- package/dist/utils/redact.d.ts.map +1 -0
- package/dist/utils/redact.js +24 -0
- package/dist/utils/redact.js.map +1 -0
- package/dist/utils/runCli.d.ts +24 -0
- package/dist/utils/runCli.d.ts.map +1 -0
- package/dist/utils/runCli.js +37 -0
- package/dist/utils/runCli.js.map +1 -0
- package/package.json +14 -4
- package/src/__tests__/deployContract.test.ts +429 -0
- package/src/__tests__/errors.test.ts +84 -0
- package/src/__tests__/fixtures/sigint-deploy-harness.ts +95 -0
- package/src/__tests__/fork/api.test.ts +143 -0
- package/src/__tests__/harness/Harness.createLive.test.ts +57 -0
- package/src/__tests__/harness/Harness.proxy.test.ts +115 -0
- package/src/__tests__/harness/_fixture.ts +131 -0
- package/src/__tests__/harness/codeObject.deploy.test.ts +319 -0
- package/src/__tests__/harness/codeObject.upgrade.test.ts +156 -0
- package/src/__tests__/harness/script.test.ts +245 -0
- package/src/__tests__/harness/view.test.ts +104 -0
- package/src/__tests__/runtime.test.ts +182 -0
- package/src/cli.ts +2 -1
- package/src/commands/__tests__/compile.test.ts +407 -0
- package/src/commands/__tests__/init.test.ts +125 -0
- package/src/commands/__tests__/run.test.ts +192 -0
- package/src/commands/__tests__/test-move.test.ts +81 -0
- package/src/commands/__tests__/test.test.ts +204 -0
- package/src/commands/__tests__/update.test.ts +223 -0
- package/src/commands/compile.ts +168 -32
- package/src/commands/fork/__tests__/create.test.ts +132 -0
- package/src/commands/fork/__tests__/fund.test.ts +104 -0
- package/src/commands/fork/__tests__/list.test.ts +139 -0
- package/src/commands/fork/__tests__/serve.test.ts +121 -0
- package/src/commands/fork/__tests__/view-resource.test.ts +101 -0
- package/src/commands/fork/create.ts +4 -3
- package/src/commands/fork/fund.ts +16 -9
- package/src/commands/fork/list.ts +3 -2
- package/src/commands/fork/serve.ts +6 -3
- package/src/commands/fork/view-resource.ts +11 -6
- package/src/commands/run.ts +54 -28
- package/src/commands/test-move.ts +4 -3
- package/src/commands/test.ts +56 -44
- package/src/commands/update.ts +19 -16
- package/src/core/AccountManager.ts +23 -10
- package/src/core/Publisher.ts +322 -0
- package/src/core/__tests__/AccountManager.test.ts +290 -0
- package/src/core/__tests__/config.test.ts +377 -0
- package/src/core/__tests__/deployments.test.ts +247 -0
- package/src/core/__tests__/shell.test.ts +138 -0
- package/src/core/config.ts +96 -12
- package/src/core/contract.ts +13 -4
- package/src/core/deployments.ts +13 -11
- package/src/core/movementProfile.ts +179 -0
- package/src/core/shell.ts +34 -14
- package/src/errors.ts +60 -0
- package/src/fork/__tests__/manager.test.ts +385 -0
- package/src/fork/__tests__/server.test.ts +65 -0
- package/src/fork/__tests__/storage.test.ts +281 -0
- package/src/fork/__tests__/test.test.ts +97 -0
- package/src/fork/api.ts +28 -14
- package/src/fork/manager.ts +88 -43
- package/src/fork/server.ts +53 -19
- package/src/fork/storage.ts +12 -15
- package/src/fork/test.ts +58 -32
- package/src/harness/Harness.ts +228 -0
- package/src/harness/codeObject.ts +388 -0
- package/src/harness/errors.ts +22 -0
- package/src/harness/index.ts +3 -0
- package/src/harness/proxy.ts +40 -0
- package/src/harness/script.ts +196 -0
- package/src/harness/view.ts +34 -0
- package/src/helpers/__tests__/semver-utils.test.ts +121 -0
- package/src/helpers/index.ts +2 -8
- package/src/helpers/move-tests.ts +27 -23
- package/src/helpers/npm-registry.ts +4 -3
- package/src/helpers/semver-utils.ts +4 -3
- package/src/helpers/setup.ts +6 -4
- package/src/helpers/setupLocalTesting.ts +219 -200
- package/src/helpers/testFixtures.ts +106 -118
- package/src/index.ts +9 -3
- package/src/node/LocalNodeManager.ts +87 -62
- package/src/node/__tests__/LocalNodeManager.test.ts +452 -0
- package/src/runtime.ts +30 -288
- package/src/templates/README.md +1 -1
- package/src/templates/movehat.config.ts +10 -0
- package/src/templates/package.json +2 -1
- package/src/templates/scripts/deploy-counter.ts +46 -38
- package/src/templates/tests/Counter.test.ts +39 -51
- package/src/templates/types/movehat.d.ts +6 -9
- package/src/types/config.ts +8 -0
- package/src/types/fork.ts +7 -1
- package/src/types/harness.ts +182 -0
- package/src/types/runtime.ts +11 -3
- package/src/ui/__tests__/colors.test.ts +156 -0
- package/src/ui/colors.ts +5 -2
- package/src/ui/logger.ts +22 -0
- package/src/ui/symbols.ts +7 -1
- package/src/utils/__tests__/address.test.ts +93 -0
- package/src/utils/__tests__/childProcessAdapter.test.ts +266 -0
- package/src/utils/__tests__/runCli.test.ts +240 -0
- package/src/utils/address.ts +56 -0
- package/src/utils/childProcessAdapter.ts +215 -0
- package/src/utils/parseCliOutput.ts +27 -0
- package/src/utils/redact.ts +24 -0
- package/src/utils/runCli.ts +64 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
import { Harness, HarnessDisposedError } from "../../harness/index.js";
|
|
6
|
+
import {
|
|
7
|
+
CliExecutionError,
|
|
8
|
+
ModuleAlreadyDeployedError,
|
|
9
|
+
PostPublishError,
|
|
10
|
+
} from "../../errors.js";
|
|
11
|
+
import type {
|
|
12
|
+
ChildProcessAdapter,
|
|
13
|
+
RunInput,
|
|
14
|
+
RunResult,
|
|
15
|
+
} from "../../utils/childProcessAdapter.js";
|
|
16
|
+
import { setupHarnessTestFixture, type HarnessTestFixture } from "./_fixture.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Tests for `Harness.deployCodeObject` — exercises the new
|
|
20
|
+
* `move deploy-object` code path with the shared profile helpers
|
|
21
|
+
* lifted out of Publisher in Commit 1 of this PR.
|
|
22
|
+
*
|
|
23
|
+
* Uses the same fake-adapter + tmpdir-HOME pattern as
|
|
24
|
+
* `__tests__/deployContract.test.ts`. No real Movement CLI calls.
|
|
25
|
+
*/
|
|
26
|
+
describe("Harness.deployCodeObject", () => {
|
|
27
|
+
let fixture: HarnessTestFixture;
|
|
28
|
+
|
|
29
|
+
const OBJECT_ADDRESS = "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890";
|
|
30
|
+
const TX_HASH = "0x1111111111111111111111111111111111111111111111111111111111111111";
|
|
31
|
+
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
fixture = setupHarnessTestFixture({ withTmpHome: true });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
fixture.teardown();
|
|
38
|
+
delete process.env.MH_CLI_REDEPLOY;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function makeAdapter(steps: {
|
|
42
|
+
build: RunResult;
|
|
43
|
+
deploy: RunResult;
|
|
44
|
+
}): {
|
|
45
|
+
adapter: ChildProcessAdapter;
|
|
46
|
+
calls: RunInput[];
|
|
47
|
+
} {
|
|
48
|
+
const calls: RunInput[] = [];
|
|
49
|
+
const adapter: ChildProcessAdapter = {
|
|
50
|
+
async run(input) {
|
|
51
|
+
calls.push(input);
|
|
52
|
+
if (input.args[1] === "build") return steps.build;
|
|
53
|
+
if (input.args[1] === "deploy-object") return steps.deploy;
|
|
54
|
+
if (input.args[1] === "upgrade-object") return steps.deploy;
|
|
55
|
+
throw new Error(`unexpected movement subcommand: ${input.args[1]}`);
|
|
56
|
+
},
|
|
57
|
+
spawn() {
|
|
58
|
+
throw new Error("spawn not used in codeObject tests");
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
return { adapter, calls };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function successStdout(): string {
|
|
65
|
+
return [
|
|
66
|
+
"Building package...",
|
|
67
|
+
"BUILDING dummy",
|
|
68
|
+
"Code was successfully deployed to object address " + OBJECT_ADDRESS,
|
|
69
|
+
`transaction hash: ${TX_HASH}`,
|
|
70
|
+
"{ \"Result\": { \"success\": true } }",
|
|
71
|
+
].join("\n");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
it("happy path: returns CodeObjectInfo with parsed object address + txHash and writes deployment record", async () => {
|
|
75
|
+
const { adapter, calls } = makeAdapter({
|
|
76
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
77
|
+
deploy: { exitCode: 0, stdout: successStdout(), stderr: "" },
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const harness = await Harness.createLive("testnet");
|
|
81
|
+
try {
|
|
82
|
+
const result = await harness.deployCodeObject({
|
|
83
|
+
moduleName: "counter",
|
|
84
|
+
adapter,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
expect(result.address).toBe(OBJECT_ADDRESS);
|
|
88
|
+
expect(result.txHash).toBe(TX_HASH);
|
|
89
|
+
expect(result.moduleName).toBe("counter");
|
|
90
|
+
expect(result.network).toBe("testnet");
|
|
91
|
+
expect(result.deployer).toBe(harness.runtime.account.accountAddress.toString());
|
|
92
|
+
expect(result.timestamp).toBeGreaterThan(0);
|
|
93
|
+
|
|
94
|
+
// Deployment file written to deployments/testnet/counter.json
|
|
95
|
+
const deploymentPath = join(fixture.tmpCwd, "deployments", "testnet", "counter.json");
|
|
96
|
+
expect(existsSync(deploymentPath)).toBe(true);
|
|
97
|
+
const saved = JSON.parse(readFileSync(deploymentPath, "utf-8"));
|
|
98
|
+
expect(saved.address).toBe(OBJECT_ADDRESS);
|
|
99
|
+
expect(saved.txHash).toBe(TX_HASH);
|
|
100
|
+
|
|
101
|
+
// Verify the CLI calls: build then deploy-object
|
|
102
|
+
expect(calls).toHaveLength(2);
|
|
103
|
+
expect(calls[0]?.args.slice(0, 2)).toEqual(["move", "build"]);
|
|
104
|
+
expect(calls[1]?.args.slice(0, 4)).toEqual([
|
|
105
|
+
"move",
|
|
106
|
+
"deploy-object",
|
|
107
|
+
"--address-name",
|
|
108
|
+
"counter",
|
|
109
|
+
]);
|
|
110
|
+
expect(calls[1]?.args).toContain("--assume-yes");
|
|
111
|
+
} finally {
|
|
112
|
+
await harness.cleanup();
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("idempotency: re-deploying the same module throws ModuleAlreadyDeployedError and does NOT invoke the CLI", async () => {
|
|
117
|
+
// First, plant an existing deployment record by running a successful deploy.
|
|
118
|
+
const first = makeAdapter({
|
|
119
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
120
|
+
deploy: { exitCode: 0, stdout: successStdout(), stderr: "" },
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const harness1 = await Harness.createLive("testnet");
|
|
124
|
+
await harness1.deployCodeObject({ moduleName: "counter", adapter: first.adapter });
|
|
125
|
+
await harness1.cleanup();
|
|
126
|
+
|
|
127
|
+
// Second deploy with same moduleName + same network — must reject.
|
|
128
|
+
const second = makeAdapter({
|
|
129
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
130
|
+
deploy: { exitCode: 0, stdout: successStdout(), stderr: "" },
|
|
131
|
+
});
|
|
132
|
+
const harness2 = await Harness.createLive("testnet");
|
|
133
|
+
try {
|
|
134
|
+
let caught: unknown;
|
|
135
|
+
try {
|
|
136
|
+
await harness2.deployCodeObject({ moduleName: "counter", adapter: second.adapter });
|
|
137
|
+
} catch (err) {
|
|
138
|
+
caught = err;
|
|
139
|
+
}
|
|
140
|
+
expect(caught).toBeInstanceOf(ModuleAlreadyDeployedError);
|
|
141
|
+
const err = caught as ModuleAlreadyDeployedError;
|
|
142
|
+
expect(err.moduleName).toBe("counter");
|
|
143
|
+
expect(err.network).toBe("testnet");
|
|
144
|
+
// CLI must not have been invoked on the second attempt.
|
|
145
|
+
expect(second.calls).toHaveLength(0);
|
|
146
|
+
} finally {
|
|
147
|
+
await harness2.cleanup();
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("MH_CLI_REDEPLOY=true bypasses the idempotency check", async () => {
|
|
152
|
+
// Plant the first deployment.
|
|
153
|
+
const first = makeAdapter({
|
|
154
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
155
|
+
deploy: { exitCode: 0, stdout: successStdout(), stderr: "" },
|
|
156
|
+
});
|
|
157
|
+
const harness1 = await Harness.createLive("testnet");
|
|
158
|
+
await harness1.deployCodeObject({ moduleName: "counter", adapter: first.adapter });
|
|
159
|
+
await harness1.cleanup();
|
|
160
|
+
|
|
161
|
+
// Redeploy with the env flag — should call the CLI again.
|
|
162
|
+
process.env.MH_CLI_REDEPLOY = "true";
|
|
163
|
+
const second = makeAdapter({
|
|
164
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
165
|
+
deploy: { exitCode: 0, stdout: successStdout(), stderr: "" },
|
|
166
|
+
});
|
|
167
|
+
const harness2 = await Harness.createLive("testnet");
|
|
168
|
+
try {
|
|
169
|
+
const result = await harness2.deployCodeObject({
|
|
170
|
+
moduleName: "counter",
|
|
171
|
+
adapter: second.adapter,
|
|
172
|
+
});
|
|
173
|
+
expect(result.address).toBe(OBJECT_ADDRESS);
|
|
174
|
+
// The CLI WAS invoked the second time.
|
|
175
|
+
expect(second.calls.length).toBeGreaterThan(0);
|
|
176
|
+
} finally {
|
|
177
|
+
await harness2.cleanup();
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it("build failure rethrows CliExecutionError and never writes a profile to ~/.aptos/config.yaml", async () => {
|
|
182
|
+
const { adapter } = makeAdapter({
|
|
183
|
+
build: { exitCode: 1, stdout: "", stderr: "compilation error: undefined identifier" },
|
|
184
|
+
deploy: { exitCode: 0, stdout: "", stderr: "" },
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
const harness = await Harness.createLive("testnet");
|
|
188
|
+
try {
|
|
189
|
+
let caught: unknown;
|
|
190
|
+
try {
|
|
191
|
+
await harness.deployCodeObject({ moduleName: "counter", adapter });
|
|
192
|
+
} catch (err) {
|
|
193
|
+
caught = err;
|
|
194
|
+
}
|
|
195
|
+
expect(caught).toBeInstanceOf(CliExecutionError);
|
|
196
|
+
// The profile-write happens AFTER build, so build failure should
|
|
197
|
+
// never have touched ~/.aptos/config.yaml.
|
|
198
|
+
expect(existsSync(join(fixture.tmpHome!, ".aptos", "config.yaml"))).toBe(false);
|
|
199
|
+
} finally {
|
|
200
|
+
await harness.cleanup();
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it("deploy-object failure rethrows AND the temp profile is removed from ~/.aptos/config.yaml in finally", async () => {
|
|
205
|
+
const { adapter } = makeAdapter({
|
|
206
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
207
|
+
deploy: { exitCode: 1, stdout: "", stderr: "transaction failed: insufficient funds" },
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
const harness = await Harness.createLive("testnet");
|
|
211
|
+
try {
|
|
212
|
+
let caught: unknown;
|
|
213
|
+
try {
|
|
214
|
+
await harness.deployCodeObject({ moduleName: "counter", adapter });
|
|
215
|
+
} catch (err) {
|
|
216
|
+
caught = err;
|
|
217
|
+
}
|
|
218
|
+
expect(caught).toBeInstanceOf(CliExecutionError);
|
|
219
|
+
// The finally block must have cleaned the temp profile — file
|
|
220
|
+
// unlinked because we wrote a fresh profile-only yaml.
|
|
221
|
+
expect(existsSync(join(fixture.tmpHome!, ".aptos", "config.yaml"))).toBe(false);
|
|
222
|
+
} finally {
|
|
223
|
+
await harness.cleanup();
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it("output without a parseable object address throws a clear error (not CliExecutionError)", async () => {
|
|
228
|
+
const { adapter } = makeAdapter({
|
|
229
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
230
|
+
deploy: {
|
|
231
|
+
exitCode: 0,
|
|
232
|
+
stdout: "deployed successfully (but no object address mentioned)",
|
|
233
|
+
stderr: "",
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
const harness = await Harness.createLive("testnet");
|
|
238
|
+
try {
|
|
239
|
+
let caught: unknown;
|
|
240
|
+
try {
|
|
241
|
+
await harness.deployCodeObject({ moduleName: "counter", adapter });
|
|
242
|
+
} catch (err) {
|
|
243
|
+
caught = err;
|
|
244
|
+
}
|
|
245
|
+
expect(caught).toBeInstanceOf(Error);
|
|
246
|
+
// Not a CliExecutionError — the CLI succeeded, our parser failed.
|
|
247
|
+
expect(caught).not.toBeInstanceOf(CliExecutionError);
|
|
248
|
+
expect((caught as Error).message).toMatch(/Could not parse object address/);
|
|
249
|
+
} finally {
|
|
250
|
+
await harness.cleanup();
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it("addressName override is used in --address-name CLI flag; moduleName remains the save-record key", async () => {
|
|
255
|
+
// Example use case: Move source `module hello_blockchain::counter`
|
|
256
|
+
// with Move.toml `[addresses] hello_blockchain = "_"`. The CLI's
|
|
257
|
+
// --address-name must match the Move.toml entry (`hello_blockchain`)
|
|
258
|
+
// while the on-chain module identifier + the save key + the
|
|
259
|
+
// getContract argument stay `counter`.
|
|
260
|
+
const { adapter, calls } = makeAdapter({
|
|
261
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
262
|
+
deploy: { exitCode: 0, stdout: successStdout(), stderr: "" },
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
const harness = await Harness.createLive("testnet");
|
|
266
|
+
try {
|
|
267
|
+
const result = await harness.deployCodeObject({
|
|
268
|
+
moduleName: "counter",
|
|
269
|
+
addressName: "hello_blockchain",
|
|
270
|
+
adapter,
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
// Save record + return value use moduleName (not addressName).
|
|
274
|
+
expect(result.moduleName).toBe("counter");
|
|
275
|
+
const deploymentPath = join(fixture.tmpCwd, "deployments", "testnet", "counter.json");
|
|
276
|
+
expect(existsSync(deploymentPath)).toBe(true);
|
|
277
|
+
const saved = JSON.parse(readFileSync(deploymentPath, "utf-8"));
|
|
278
|
+
expect(saved.moduleName).toBe("counter");
|
|
279
|
+
|
|
280
|
+
// CLI flag was the overridden addressName.
|
|
281
|
+
const deployCall = calls.find((c) => c.args[1] === "deploy-object")!;
|
|
282
|
+
const addressNameIdx = deployCall.args.indexOf("--address-name");
|
|
283
|
+
expect(addressNameIdx).toBeGreaterThanOrEqual(0);
|
|
284
|
+
expect(deployCall.args[addressNameIdx + 1]).toBe("hello_blockchain");
|
|
285
|
+
} finally {
|
|
286
|
+
await harness.cleanup();
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it("addressName defaults to moduleName when omitted (back-compat for template case)", async () => {
|
|
291
|
+
const { adapter, calls } = makeAdapter({
|
|
292
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
293
|
+
deploy: { exitCode: 0, stdout: successStdout(), stderr: "" },
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
const harness = await Harness.createLive("testnet");
|
|
297
|
+
try {
|
|
298
|
+
await harness.deployCodeObject({ moduleName: "counter", adapter });
|
|
299
|
+
const deployCall = calls.find((c) => c.args[1] === "deploy-object")!;
|
|
300
|
+
const addressNameIdx = deployCall.args.indexOf("--address-name");
|
|
301
|
+
expect(deployCall.args[addressNameIdx + 1]).toBe("counter");
|
|
302
|
+
} finally {
|
|
303
|
+
await harness.cleanup();
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
it("fork-mode harness throws synchronously before any CLI call (covered separately for createLocal/createFork in M4 integration suite)", async () => {
|
|
308
|
+
// This case can't be tested with a real createFork (it spawns a fork
|
|
309
|
+
// server). Instead, prove that the disposed-instance path also fires
|
|
310
|
+
// synchronously: a poisoned harness throws HarnessDisposedError on
|
|
311
|
+
// property access, BEFORE any CLI call is attempted. The fork-mode
|
|
312
|
+
// guard uses the same synchronous-throw pattern.
|
|
313
|
+
const harness = await Harness.createLive("testnet");
|
|
314
|
+
await harness.cleanup();
|
|
315
|
+
expect(() => harness.deployCodeObject({ moduleName: "x" })).toThrow(
|
|
316
|
+
HarnessDisposedError
|
|
317
|
+
);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
import { Harness } from "../../harness/index.js";
|
|
6
|
+
import { CliExecutionError } from "../../errors.js";
|
|
7
|
+
import type {
|
|
8
|
+
ChildProcessAdapter,
|
|
9
|
+
RunInput,
|
|
10
|
+
RunResult,
|
|
11
|
+
} from "../../utils/childProcessAdapter.js";
|
|
12
|
+
import { setupHarnessTestFixture, type HarnessTestFixture } from "./_fixture.js";
|
|
13
|
+
|
|
14
|
+
describe("Harness.upgradeCodeObject", () => {
|
|
15
|
+
let fixture: HarnessTestFixture;
|
|
16
|
+
|
|
17
|
+
const EXISTING_OBJECT =
|
|
18
|
+
"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890";
|
|
19
|
+
const NEW_TX_HASH =
|
|
20
|
+
"0x2222222222222222222222222222222222222222222222222222222222222222";
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
fixture = setupHarnessTestFixture({ withTmpHome: true });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
fixture.teardown();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
function makeAdapter(steps: { build: RunResult; upgrade: RunResult }): {
|
|
31
|
+
adapter: ChildProcessAdapter;
|
|
32
|
+
calls: RunInput[];
|
|
33
|
+
} {
|
|
34
|
+
const calls: RunInput[] = [];
|
|
35
|
+
const adapter: ChildProcessAdapter = {
|
|
36
|
+
async run(input) {
|
|
37
|
+
calls.push(input);
|
|
38
|
+
if (input.args[1] === "build") return steps.build;
|
|
39
|
+
if (input.args[1] === "upgrade-object") return steps.upgrade;
|
|
40
|
+
throw new Error(`unexpected movement subcommand: ${input.args[1]}`);
|
|
41
|
+
},
|
|
42
|
+
spawn() {
|
|
43
|
+
throw new Error("spawn not used in codeObject.upgrade tests");
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
return { adapter, calls };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function upgradeStdout(): string {
|
|
50
|
+
return [
|
|
51
|
+
"Building package...",
|
|
52
|
+
"BUILDING dummy",
|
|
53
|
+
"Successfully upgraded modules at object address " + EXISTING_OBJECT,
|
|
54
|
+
`transaction hash: ${NEW_TX_HASH}`,
|
|
55
|
+
].join("\n");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
it("happy path: upgrades existing object, returns DeploymentInfo with new txHash and the same (existing) address", async () => {
|
|
59
|
+
const { adapter, calls } = makeAdapter({
|
|
60
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
61
|
+
upgrade: { exitCode: 0, stdout: upgradeStdout(), stderr: "" },
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const harness = await Harness.createLive("testnet");
|
|
65
|
+
try {
|
|
66
|
+
const result = await harness.upgradeCodeObject({
|
|
67
|
+
moduleName: "counter",
|
|
68
|
+
objectAddress: EXISTING_OBJECT,
|
|
69
|
+
adapter,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
expect(result.address).toBe(EXISTING_OBJECT);
|
|
73
|
+
expect(result.txHash).toBe(NEW_TX_HASH);
|
|
74
|
+
expect(result.moduleName).toBe("counter");
|
|
75
|
+
|
|
76
|
+
// Saved deployment record reflects the new state.
|
|
77
|
+
const deploymentPath = join(fixture.tmpCwd, "deployments", "testnet", "counter.json");
|
|
78
|
+
expect(existsSync(deploymentPath)).toBe(true);
|
|
79
|
+
const saved = JSON.parse(readFileSync(deploymentPath, "utf-8"));
|
|
80
|
+
expect(saved.address).toBe(EXISTING_OBJECT);
|
|
81
|
+
expect(saved.txHash).toBe(NEW_TX_HASH);
|
|
82
|
+
|
|
83
|
+
// CLI args contain the required --object-address flag.
|
|
84
|
+
const upgradeCall = calls.find((c) => c.args[1] === "upgrade-object");
|
|
85
|
+
expect(upgradeCall).toBeDefined();
|
|
86
|
+
expect(upgradeCall?.args).toContain("--object-address");
|
|
87
|
+
expect(upgradeCall?.args).toContain(EXISTING_OBJECT);
|
|
88
|
+
expect(upgradeCall?.args.slice(0, 4)).toEqual([
|
|
89
|
+
"move",
|
|
90
|
+
"upgrade-object",
|
|
91
|
+
"--address-name",
|
|
92
|
+
"counter",
|
|
93
|
+
]);
|
|
94
|
+
} finally {
|
|
95
|
+
await harness.cleanup();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("missing objectAddress throws synchronously before any CLI call", async () => {
|
|
100
|
+
const { adapter, calls } = makeAdapter({
|
|
101
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
102
|
+
upgrade: { exitCode: 0, stdout: upgradeStdout(), stderr: "" },
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const harness = await Harness.createLive("testnet");
|
|
106
|
+
try {
|
|
107
|
+
let caught: unknown;
|
|
108
|
+
try {
|
|
109
|
+
await harness.upgradeCodeObject({
|
|
110
|
+
moduleName: "counter",
|
|
111
|
+
// Intentionally empty — exercise the early-throw path.
|
|
112
|
+
objectAddress: "",
|
|
113
|
+
adapter,
|
|
114
|
+
});
|
|
115
|
+
} catch (err) {
|
|
116
|
+
caught = err;
|
|
117
|
+
}
|
|
118
|
+
expect(caught).toBeInstanceOf(Error);
|
|
119
|
+
expect((caught as Error).message).toMatch(/objectAddress/);
|
|
120
|
+
// No CLI calls should have been made.
|
|
121
|
+
expect(calls).toHaveLength(0);
|
|
122
|
+
} finally {
|
|
123
|
+
await harness.cleanup();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("upgrade-object CLI failure rethrows AND cleans the temp profile", async () => {
|
|
128
|
+
const { adapter } = makeAdapter({
|
|
129
|
+
build: { exitCode: 0, stdout: "build ok", stderr: "" },
|
|
130
|
+
upgrade: {
|
|
131
|
+
exitCode: 1,
|
|
132
|
+
stdout: "",
|
|
133
|
+
stderr: "upgrade failed: incompatible module",
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const harness = await Harness.createLive("testnet");
|
|
138
|
+
try {
|
|
139
|
+
let caught: unknown;
|
|
140
|
+
try {
|
|
141
|
+
await harness.upgradeCodeObject({
|
|
142
|
+
moduleName: "counter",
|
|
143
|
+
objectAddress: EXISTING_OBJECT,
|
|
144
|
+
adapter,
|
|
145
|
+
});
|
|
146
|
+
} catch (err) {
|
|
147
|
+
caught = err;
|
|
148
|
+
}
|
|
149
|
+
expect(caught).toBeInstanceOf(CliExecutionError);
|
|
150
|
+
// Temp profile cleaned up in finally.
|
|
151
|
+
expect(existsSync(join(fixture.tmpHome!, ".aptos", "config.yaml"))).toBe(false);
|
|
152
|
+
} finally {
|
|
153
|
+
await harness.cleanup();
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|