-
Notifications
You must be signed in to change notification settings - Fork 168
Closed as duplicate of#4318
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue is a duplicate of an existing oneThis issue is a duplicate of an existing one
Description
Expected Behavior
When I execute my repo unit tests in an environment not configured for aws development (no ENV variables set for AWS_REGION) I would expect my tests to still pass.
Current Behavior
When running our unit tests the same way we were in previous versions we nor get the following error
● Test suite failed to run
Environment variable AWS_REGION is required
Code snippet
logger.ts
import { Logger } from '@aws-lambda-powertools/logger';
const logger = new Logger({
serviceName: process.env.service || 'N/A'
});
export { logger };
function.ts
import { logger} from ./logger.ts;
export function logMessage(message: string): void {
logger.info(message);
}
import { logMessage } from '../src/basic-logger-function';
describe('logMessage', () => {
it('should log a message', () => {
logMessage('Hello World');
});
});
Steps to Reproduce
- Create above files
unset AWS_REGION
- run test
- Test fail Environment variable AWS_REGION is required
Possible Solution
Resolved here #4319
Powertools for AWS Lambda (TypeScript) version
v2.25.0
AWS Lambda function runtime
22.x
Packaging format used
npm
Execution logs
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue is a duplicate of an existing oneThis issue is a duplicate of an existing one
Type
Projects
Status
Closed