Skip to content

Conversation

@vicheey
Copy link
Contributor

@vicheey vicheey commented Mar 6, 2025

Problem

There is a side effect from sandbox.spy(AppBuilderRootNode.instance) between two integration tests for AppBuilder causing test failure due to TypeError: Attempted to wrap onDidChangeChildren which is already wrapped`

 1) "before each" hook for "creates an AppBuilderRootNode with correct label":
     TypeError: Attempted to wrap onDidChangeChildren which is already wrapped
      at checkWrappedMethod (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/wrap-method.js:64:21)
      at wrapMethod (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/wrap-method.js:135:13)
      at spy (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/spy.js:180:16)
      at /Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/walk-object.js:33:17
      at /Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/walk.js:27:22
      at Array.forEach (<anonymous>)
      at walkInternal (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/walk.js:19:5)
      at walk (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/walk.js:48:12)
      at walkObject (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/walk-object.js:18:5)
      at Function.spy (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/spy.js:170:16)
      at Sandbox.spy (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/sandbox.js:383:35)
      at Context.<anonymous> (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/packages/core/src/testInteg/appBuilder/serverlessLand/main.test.ts:34:28)
  --------------
  Error: Stack Trace for original
      at extendObjectWithWrappedMethods (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/wrap-method.js:169:34)
      at wrapMethod (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/wrap-method.js:157:5)
      at spy (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/spy.js:180:16)
      at /Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/walk-object.js:33:17
      at /Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/walk.js:27:22
      at Array.forEach (<anonymous>)
      at walkInternal (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/walk.js:19:5)
      at walk (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/walk.js:48:12)
      at walkObject (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/util/core/walk-object.js:18:5)
      at Function.spy (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/spy.js:170:16)
      at Sandbox.spy (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/node_modules/sinon/lib/sinon/sandbox.js:383:35)
      at Context.<anonymous> (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/packages/core/src/testInteg/appBuilder/sidebar/appBuilderNode.test.ts:35:28)
      at Context.fn (/Volumes/workplace/Lambda Tooling/aws-toolkit-vscode/packages/core/src/test/setupUtil.ts:34:24)
      at processImmediate (node:internal/timers:483:21)
      at process.topLevelDomainCallback (node:domain:161:15)
      at process.callbackTrampoline (node:internal/async_hooks:128:24)

Solution

Add additional layer of describe().

Test result:

Walkthrough pattern URL exists
    ✔ Walkthrough pattern URL exists for APIdotnet (623ms)
    ✔ Walkthrough pattern URL exists for APInode (510ms)
    ✔ Walkthrough pattern URL exists for APIpython (473ms)
    ✔ Walkthrough pattern URL exists for APIjava (559ms)
    ✔ Walkthrough pattern URL exists for S3dotnet (584ms)
    ✔ Walkthrough pattern URL exists for S3node (525ms)
    ✔ Walkthrough pattern URL exists for S3python (566ms)
    ✔ Walkthrough pattern URL exists for S3java (560ms)
  Application Builder
    root node
      ✔ creates an AppBuilderRootNode with correct label
      ✔ generates correct number of children nodes: walkthrough node + project nodes
    application nodes in workspace (Test in order)
      ✔ 1: contains application node for appbuilder-test-app
      ✔ 2: contains correct application node properties
      ✔ 3: contains correct resource node properties (4266ms)
      ✔ 4: has registered refresh command successfully
      ✔ 5: triggers auto refresh when there a file getting updated (509ms)
  Happy Path
    ✔ creates project from Serverless Land integration (1083ms)
  16 passing (10s)
globalSetup: after()
deleteTestTempDirs: deleted 2 test temp dirs


  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@vicheey vicheey requested a review from a team as a code owner March 6, 2025 18:01
@Hweinstock
Copy link
Contributor

Hweinstock commented Mar 6, 2025

/runIntegrationTests 2e2c429

rootNode = sandbox.spy(AppBuilderRootNode.instance)
})
// Additional layer of describe() needed here to prevent side effect from
// `sandbox.spy(AppBuilderRootNode.instance)`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this comment be deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment here is deliberate.

@Hweinstock
Copy link
Contributor

LGTM, will approve and merge post-release.

@Hweinstock Hweinstock merged commit e3b73c4 into aws:master Mar 6, 2025
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants