Skip to content

Commit 2efef68

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

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,27 @@ 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 () => {
42+
beforeEach(async () => {
43+
rootNode = sinon.spy(AppBuilderRootNode.instance)
44+
})
45+
46+
afterEach(() => {
47+
sinon.restore()
48+
})
49+
4350
it('creates project from Serverless Land integration', async () => {
4451
/**
4552
* Selection:

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,28 @@ 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)
34+
3635
projects = await detectSamProjects()
3736

3837
// Set the walkthrough status to true to ensure the root node has a walkthrough node
@@ -41,9 +40,9 @@ describe('Application Builder', async () => {
4140
})
4241

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

4948
describe('root node', async () => {

0 commit comments

Comments
 (0)