Skip to content

Commit 5d0d04a

Browse files
committed
fix: Clear generated env directory before shim generation
1 parent 7f78fc8 commit 5d0d04a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/backend-function/src/function_env_type_generator.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import path from 'path';
88

99
void describe('FunctionEnvironmentTypeGenerator', () => {
1010
beforeEach(() => {
11-
resetFactoryCount();
11+
resetFactoryGlobalState();
1212
});
1313
void it('generates a type definition file', () => {
1414
const fsOpenSyncMock = mock.method(fs, 'openSync');
@@ -125,7 +125,7 @@ void describe('FunctionEnvironmentTypeGenerator', () => {
125125
fsExistsSyncMock.mock.restore();
126126
fsRmSyncMock.mock.restore();
127127
});
128-
const resetFactoryCount = () => {
128+
const resetFactoryGlobalState = () => {
129129
FunctionEnvironmentTypeGenerator.isEnvDirectoryInitialized = false;
130130
};
131131
});

packages/backend-function/src/function_env_type_generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { EOL } from 'os';
77
* Generates a typed process.env shim for environment variables
88
*/
99
export class FunctionEnvironmentTypeGenerator {
10-
// Using this to ensure directory is cleared once
10+
// Using this to ensure directory is cleared once per synthesis
1111
static isEnvDirectoryInitialized = false;
1212
private readonly header =
1313
'// This file is auto-generated by Amplify. Edits will be overwritten.';

0 commit comments

Comments
 (0)