Skip to content

Commit 0d8e632

Browse files
committed
prevent integ test transient failure due to spying AppBuilder node
1 parent 6cfe2c1 commit 0d8e632

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

packages/core/src/testInteg/appBuilder/serverlessLand/main.test.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,16 @@ describe('Serverless Land Integration', async () => {
2626
const workspaceFolder = vscode.workspace.workspaceFolders![0]
2727
const projectFolder = 'my-project-from-Serverless-Land'
2828
let rootNode: sinon.SinonSpiedInstance<AppBuilderRootNode>
29-
let sandbox: sinon.SinonSandbox
3029

31-
beforeEach(async () => {
32-
sandbox = sinon.createSandbox()
30+
before(async () => {
31+
sinon.createSandbox()
3332
await fs.delete(path.join(workspaceFolder.uri.fsPath, projectFolder), { recursive: true })
34-
rootNode = sandbox.spy(AppBuilderRootNode.instance)
33+
rootNode = sinon.spy(AppBuilderRootNode.instance)
3534
})
3635

37-
afterEach(async () => {
36+
after(async () => {
3837
await fs.delete(path.join(workspaceFolder.uri.fsPath, projectFolder), { recursive: true })
39-
sandbox.restore()
38+
sinon.restore()
4039
})
4140

4241
describe('Happy Path', async () => {

packages/core/src/testInteg/appBuilder/sidebar/appBuilderNode.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,27 @@ import { detectSamProjects } from '../../../awsService/appBuilder/explorer/detec
1010
import { SamAppLocation } from '../../../awsService/appBuilder/explorer/samProject'
1111
import { AppNode } from '../../../awsService/appBuilder/explorer/nodes/appNode'
1212
import { ResourceNode } from '../../../awsService/appBuilder/explorer/nodes/resourceNode'
13-
import sinon from 'sinon'
13+
import * as sinon from 'sinon'
1414
import { writeSamconfigGlobal, SamConfig } from '../../../shared/sam/config'
1515
import { globals, sleep } from '../../../shared'
1616
import path from 'path'
1717

1818
describe('Application Builder', async () => {
1919
let rootNode: sinon.SinonSpiedInstance<AppBuilderRootNode>
2020
let projects: SamAppLocation[]
21-
let sandbox: sinon.SinonSandbox
2221
let originalWalkThroughState: boolean
2322
let projectNodes: any[]
2423

2524
before(async () => {
26-
sandbox = sinon.createSandbox()
2725
// Set the workspace to the testFixtures folder to avoid side effects from other tests.
28-
sandbox.stub(vscode.workspace, 'workspaceFolders').value([
26+
sinon.stub(vscode.workspace, 'workspaceFolders').value([
2927
{
3028
index: 0,
3129
name: 'workspaceFolder',
3230
uri: vscode.Uri.file(path.join(__dirname, '../../../../src/testFixtures/workspaceFolder')),
3331
},
3432
])
35-
rootNode = sandbox.spy(AppBuilderRootNode.instance)
33+
rootNode = sinon.spy(AppBuilderRootNode.instance)
3634
projects = await detectSamProjects()
3735

3836
// Set the walkthrough status to true to ensure the root node has a walkthrough node
@@ -41,7 +39,7 @@ describe('Application Builder', async () => {
4139
})
4240

4341
after(async () => {
44-
sandbox.restore()
42+
sinon.restore()
4543
// Restore original status of walkthroughCompleted status
4644
await globals.globalState.update('aws.toolkit.lambda.walkthroughCompleted', originalWalkThroughState)
4745
})

0 commit comments

Comments
 (0)