From 50b66733b15eb0645ad2363dda0f2cdb5f322524 Mon Sep 17 00:00:00 2001 From: abetomo Date: Fri, 25 Jul 2025 17:14:18 +0900 Subject: [PATCH] sdk-v3: Stabilize testing on Windows GH-641 --- test/main.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/main.js b/test/main.js index db21814..2cd3d14 100644 --- a/test/main.js +++ b/test/main.js @@ -142,8 +142,12 @@ const lambdaMockSettings = { /* global before, after, beforeEach, afterEach, describe, it */ describe('lib/main', function () { - if (['win32', 'darwin'].includes(process.platform)) { - // It seems that it takes time for file operation in Windows and Mac. + if (process.platform === 'win32') { + // It seems that it takes very long time for file operation in Windows. + // So set `timeout(300000)` for the whole test. + this.timeout(300000) + } else if (process.platform === 'darwin') { + // It seems that it takes time for file operation in Mac. // So set `timeout(120000)` for the whole test. this.timeout(120000) } @@ -154,8 +158,11 @@ describe('lib/main', function () { return } execFileSync('npm', ['ci'], { cwd: sourceDirectoryForTest }) + }) + + beforeEach(() => { + program = Object.assign({}, originalProgram) // clone - // for sdk v3 mockLambdaClient.reset() mockLambdaClient.on(AddPermissionCommand).resolves(lambdaMockSettings.addPermission) mockLambdaClient.on(CreateEventSourceMappingCommand).resolves(lambdaMockSettings.createEventSourceMapping) @@ -184,10 +191,6 @@ describe('lib/main', function () { mockS3Client.on(PutObjectCommand).resolves({}) }) - beforeEach(() => { - program = Object.assign({}, originalProgram) // clone - }) - it('version should be set', () => { assert.equal(lambda.version, '1.3.0') })