diff --git a/.github/workflows/reusable-run-linting-check-and-unit-tests.yml b/.github/workflows/reusable-run-linting-check-and-unit-tests.yml index 577a66f53d..fad0e768af 100644 --- a/.github/workflows/reusable-run-linting-check-and-unit-tests.yml +++ b/.github/workflows/reusable-run-linting-check-and-unit-tests.yml @@ -48,6 +48,7 @@ jobs: "packages/jmespath", "packages/logger", "packages/tracer", + "packages/parser", ] fail-fast: false steps: @@ -91,13 +92,11 @@ jobs: - name: Run linting run: | npm run lint -w packages/metrics \ - -w packages/parameters \ - -w packages/parser + -w packages/parameters - name: Run unit tests run: | npm t -w packages/metrics \ - -w packages/parameters \ - -w packages/parser + -w packages/parameters check-examples: runs-on: ubuntu-latest env: diff --git a/.husky/pre-push b/.husky/pre-push index c3b8dee21d..ca1c0af1f6 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,6 +1,9 @@ npm t \ -w packages/metrics \ - -w packages/parameters \ - -w packages/parser + -w packages/parameters -npx vitest --run --coverage --changed="$(git merge-base HEAD main)" tests/unit +npx vitest --run \ + --exclude tests/unit/layer-publisher.test.ts \ + --coverage --coverage.thresholds.100 \ + --changed="$(git merge-base HEAD main)" \ + tests/unit diff --git a/packages/parser/jest.config.cjs b/packages/parser/jest.config.cjs deleted file mode 100644 index 23684da5b4..0000000000 --- a/packages/parser/jest.config.cjs +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = { - displayName: { - name: 'Powertools for AWS Lambda (TypeScript) utility: PARSER', - color: 'blue', - }, - runner: 'groups', - preset: 'ts-jest', - moduleNameMapper: { - '^(\\.{1,2}/.*)\\.js$': '$1', - }, - transform: { - '^.+\\.ts?$': ['ts-jest'], - }, - moduleFileExtensions: ['js', 'ts'], - collectCoverageFrom: ['**/src/**/*.ts', '!**/node_modules/**'], - testMatch: ['**/?(*.)+(spec|test).ts'], - roots: ['/src', '/tests'], - testPathIgnorePatterns: ['/node_modules/'], - testEnvironment: 'node', - coveragePathIgnorePatterns: ['/node_modules/', '/types'], - coverageThreshold: { - global: { - statements: 100, - branches: 100, - functions: 100, - lines: 100, - }, - }, - coverageReporters: ['json-summary', 'text', 'lcov'], -}; diff --git a/packages/parser/package.json b/packages/parser/package.json index c4961de3b7..ad30a4805d 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -10,10 +10,14 @@ "access": "public" }, "scripts": { - "test": "npm run test:unit", - "test:unit": "jest --group=unit --detectOpenHandles --coverage --verbose", - "jest": "jest --detectOpenHandles --coverage --verbose", - "watch": "jest --watch", + "test": "vitest --run tests/unit", + "test:unit": "vitest --run tests/unit", + "test:unit:coverage": "vitest --run tests/unit --coverage.enabled --coverage.thresholds.100 --coverage.include='src/**'", + "test:unit:types": "vitest --run tests/types --typecheck", + "test:unit:watch": "vitest tests/unit", + "test:e2e:nodejs18x": "echo 'Not implemented'", + "test:e2e:nodejs20x": "echo 'Not implemented'", + "test:e2e": "echo 'Not implemented'", "build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", "build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", diff --git a/packages/parser/tests/unit/types.test.ts b/packages/parser/tests/types/envelopes.test.ts similarity index 93% rename from packages/parser/tests/unit/types.test.ts rename to packages/parser/tests/types/envelopes.test.ts index 344a3afd0d..72cfbca86b 100644 --- a/packages/parser/tests/unit/types.test.ts +++ b/packages/parser/tests/types/envelopes.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest'; import { z } from 'zod'; import { ApiGatewayEnvelope, @@ -30,7 +31,7 @@ describe('Types ', () => { { envelope: LambdaFunctionUrlEnvelope, name: 'LambdaFunctionUrl' }, { envelope: VpcLatticeEnvelope, name: 'VpcLattice' }, { envelope: VpcLatticeV2Envelope, name: 'VpcLatticeV2' }, - ])('should infer object for $name envelope', (testCase) => { + ])('infers object types for $name envelope', (testCase) => { type Result = ParserOutput; // Define the expected type @@ -57,7 +58,7 @@ describe('Types ', () => { { envelope: SqsEnvelope, name: 'Sqs' }, { envelope: SnsEnvelope, name: 'Sns' }, { envelope: SnsSqsEnvelope, name: 'SnsSqs' }, - ])('should infer array type with $name envelope', (testCase) => { + ])('infers array types with $name envelope', (testCase) => { // Define the expected type type Result = ParserOutput; diff --git a/packages/parser/tests/unit/envelope.test.ts b/packages/parser/tests/unit/envelope.test.ts index 9d4fea59db..17659a6941 100644 --- a/packages/parser/tests/unit/envelope.test.ts +++ b/packages/parser/tests/unit/envelope.test.ts @@ -1,9 +1,4 @@ -/** - * Test decorator parser - * - * @group unit/parser - */ - +import { describe, expect, it } from 'vitest'; import { ZodError, z } from 'zod'; import { Envelope } from '../../src/envelopes/envelope.js'; diff --git a/packages/parser/tests/unit/envelopes/apigw.test.ts b/packages/parser/tests/unit/envelopes/apigw.test.ts index 8c0486884d..f50ffb9174 100644 --- a/packages/parser/tests/unit/envelopes/apigw.test.ts +++ b/packages/parser/tests/unit/envelopes/apigw.test.ts @@ -1,9 +1,4 @@ -/** - * Test built-in API Gateway REST envelope - * - * @group unit/parser/envelopes/apigw - */ - +import { describe, expect, it } from 'vitest'; import { ZodError } from 'zod'; import { ApiGatewayEnvelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; diff --git a/packages/parser/tests/unit/envelopes/apigwv2.test.ts b/packages/parser/tests/unit/envelopes/apigwv2.test.ts index b3f97512c8..8c96c7cdc3 100644 --- a/packages/parser/tests/unit/envelopes/apigwv2.test.ts +++ b/packages/parser/tests/unit/envelopes/apigwv2.test.ts @@ -1,9 +1,4 @@ -/** - * Test built-in API Gateway HTTP API (v2) envelope - * - * @group unit/parser/envelopes/apigwv2 - */ - +import { describe, expect, it } from 'vitest'; import { ZodError } from 'zod'; import { ApiGatewayV2Envelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; diff --git a/packages/parser/tests/unit/envelopes/cloudwatch.test.ts b/packages/parser/tests/unit/envelopes/cloudwatch.test.ts index 4a62d28b93..40f13ac6b7 100644 --- a/packages/parser/tests/unit/envelopes/cloudwatch.test.ts +++ b/packages/parser/tests/unit/envelopes/cloudwatch.test.ts @@ -1,11 +1,6 @@ -/** - * Test built in schema envelopes for CloudWatch - * - * @group unit/parser/envelopes - */ - import { gzipSync } from 'node:zlib'; import { generateMock } from '@anatine/zod-mock'; +import { describe, expect, it } from 'vitest'; import { ZodError } from 'zod'; import { ParseError } from '../../../src'; import { CloudWatchEnvelope } from '../../../src/envelopes/index.js'; diff --git a/packages/parser/tests/unit/envelopes/dynamodb.test.ts b/packages/parser/tests/unit/envelopes/dynamodb.test.ts index b04b01b4a5..0d40811445 100644 --- a/packages/parser/tests/unit/envelopes/dynamodb.test.ts +++ b/packages/parser/tests/unit/envelopes/dynamodb.test.ts @@ -1,11 +1,6 @@ -/** - * Test built in schema envelopes for api gateway v2 - * - * @group unit/parser/envelopes - */ - import { generateMock } from '@anatine/zod-mock'; import type { AttributeValue, DynamoDBStreamEvent } from 'aws-lambda'; +import { describe, expect, it } from 'vitest'; import { ZodError, z } from 'zod'; import { DynamoDBStreamEnvelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; diff --git a/packages/parser/tests/unit/envelopes/eventbridge.test.ts b/packages/parser/tests/unit/envelopes/eventbridge.test.ts index 8761c23e7a..5b4443cd92 100644 --- a/packages/parser/tests/unit/envelopes/eventbridge.test.ts +++ b/packages/parser/tests/unit/envelopes/eventbridge.test.ts @@ -1,11 +1,6 @@ -/** - * Test built in schema envelopes for event bridge - * - * @group unit/parser/envelopes - */ - import { generateMock } from '@anatine/zod-mock'; import type { EventBridgeEvent } from 'aws-lambda'; +import { describe, expect, it } from 'vitest'; import { ZodError } from 'zod'; import { EventBridgeEnvelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; diff --git a/packages/parser/tests/unit/envelopes/kafka.test.ts b/packages/parser/tests/unit/envelopes/kafka.test.ts index ff750f48e0..33bb9eae60 100644 --- a/packages/parser/tests/unit/envelopes/kafka.test.ts +++ b/packages/parser/tests/unit/envelopes/kafka.test.ts @@ -1,11 +1,6 @@ -/** - * Test built in schema envelopes for api gateway v2 - * - * @group unit/parser/envelopes - */ - import { generateMock } from '@anatine/zod-mock'; import type { MSKEvent, SelfManagedKafkaEvent } from 'aws-lambda'; +import { describe, expect, it } from 'vitest'; import { ParseError } from '../../../src'; import { KafkaEnvelope } from '../../../src/envelopes/index.js'; import { TestEvents, TestSchema } from '../schema/utils.js'; diff --git a/packages/parser/tests/unit/envelopes/kinesis-firehose.test.ts b/packages/parser/tests/unit/envelopes/kinesis-firehose.test.ts index 8e67e7d3ea..1f9d7baa89 100644 --- a/packages/parser/tests/unit/envelopes/kinesis-firehose.test.ts +++ b/packages/parser/tests/unit/envelopes/kinesis-firehose.test.ts @@ -1,10 +1,5 @@ -/** - * Test built in schema envelopes for Kinesis Firehose - * - * @group unit/parser/envelopes - */ - import { generateMock } from '@anatine/zod-mock'; +import { describe, expect, it } from 'vitest'; import { ZodError, type z } from 'zod'; import { ParseError } from '../../../src'; import { KinesisFirehoseEnvelope } from '../../../src/envelopes/index.js'; diff --git a/packages/parser/tests/unit/envelopes/kinesis.test.ts b/packages/parser/tests/unit/envelopes/kinesis.test.ts index f5350b3173..28c98ee382 100644 --- a/packages/parser/tests/unit/envelopes/kinesis.test.ts +++ b/packages/parser/tests/unit/envelopes/kinesis.test.ts @@ -1,11 +1,6 @@ -/** - * Test built in schema envelopes for Kinesis - * - * @group unit/parser/envelopes - */ - import { generateMock } from '@anatine/zod-mock'; import type { KinesisStreamEvent } from 'aws-lambda'; +import { describe, expect, it } from 'vitest'; import { KinesisEnvelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; import { TestEvents, TestSchema } from '../schema/utils.js'; diff --git a/packages/parser/tests/unit/envelopes/lambda.test.ts b/packages/parser/tests/unit/envelopes/lambda.test.ts index d8ed4ef50a..2260e099ed 100644 --- a/packages/parser/tests/unit/envelopes/lambda.test.ts +++ b/packages/parser/tests/unit/envelopes/lambda.test.ts @@ -1,11 +1,6 @@ -/** - * Test built in schema envelopes for Lambda Functions URL - * - * @group unit/parser/envelopes - */ - import { generateMock } from '@anatine/zod-mock'; import type { APIGatewayProxyEventV2 } from 'aws-lambda'; +import { describe, expect, it } from 'vitest'; import { ZodError } from 'zod'; import { ParseError } from '../../../src'; import { LambdaFunctionUrlEnvelope } from '../../../src/envelopes/index.js'; diff --git a/packages/parser/tests/unit/envelopes/sns.test.ts b/packages/parser/tests/unit/envelopes/sns.test.ts index f741d50a78..ff420961c9 100644 --- a/packages/parser/tests/unit/envelopes/sns.test.ts +++ b/packages/parser/tests/unit/envelopes/sns.test.ts @@ -1,11 +1,6 @@ -/** - * Test built in schema envelopes for SNS - * - * @group unit/parser/envelopes - */ - import { generateMock } from '@anatine/zod-mock'; import type { SNSEvent, SQSEvent } from 'aws-lambda'; +import { describe, expect, it } from 'vitest'; import { ZodError, type z } from 'zod'; import { SnsEnvelope, SnsSqsEnvelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; diff --git a/packages/parser/tests/unit/envelopes/sqs.test.ts b/packages/parser/tests/unit/envelopes/sqs.test.ts index 61bf8cdf0d..9e09bbf1d2 100644 --- a/packages/parser/tests/unit/envelopes/sqs.test.ts +++ b/packages/parser/tests/unit/envelopes/sqs.test.ts @@ -1,11 +1,6 @@ -/** - * Test built in schema envelopes for sqs - * - * @group unit/parser/envelopes - */ - import { generateMock } from '@anatine/zod-mock'; import type { SQSEvent } from 'aws-lambda'; +import { describe, expect, it } from 'vitest'; import { ZodError } from 'zod'; import { SqsEnvelope } from '../../../src/envelopes/sqs.js'; import { ParseError } from '../../../src/errors.js'; diff --git a/packages/parser/tests/unit/envelopes/vpc-lattice.test.ts b/packages/parser/tests/unit/envelopes/vpc-lattice.test.ts index 6fee771a98..f9390315ad 100644 --- a/packages/parser/tests/unit/envelopes/vpc-lattice.test.ts +++ b/packages/parser/tests/unit/envelopes/vpc-lattice.test.ts @@ -1,10 +1,5 @@ -/** - * Test built in schema envelopes for VPC Lattice - * - * @group unit/parser/envelopes - */ - import { generateMock } from '@anatine/zod-mock'; +import { describe, expect, it } from 'vitest'; import { ZodError } from 'zod'; import { ParseError } from '../../../src'; import { VpcLatticeEnvelope } from '../../../src/envelopes/index.js'; diff --git a/packages/parser/tests/unit/envelopes/vpc-latticev2.test.ts b/packages/parser/tests/unit/envelopes/vpc-latticev2.test.ts index 6c06f642f9..83f656b766 100644 --- a/packages/parser/tests/unit/envelopes/vpc-latticev2.test.ts +++ b/packages/parser/tests/unit/envelopes/vpc-latticev2.test.ts @@ -1,10 +1,5 @@ -/** - * Test built in schema envelopes for VPC Lattice V2 - * - * @group unit/parser/envelopes - */ - import { generateMock } from '@anatine/zod-mock'; +import { describe, expect, it } from 'vitest'; import { ZodError } from 'zod'; import { ParseError } from '../../../src'; import { VpcLatticeV2Envelope } from '../../../src/envelopes/index.js'; diff --git a/packages/parser/tests/unit/helpers.test.ts b/packages/parser/tests/unit/helpers.test.ts index e46c36b2b6..d52d0f44df 100644 --- a/packages/parser/tests/unit/helpers.test.ts +++ b/packages/parser/tests/unit/helpers.test.ts @@ -1,8 +1,4 @@ -/** - * Test decorator parser - * - * @group unit/parser - */ +import { describe, expect, it } from 'vitest'; import { z } from 'zod'; import { JSONStringified } from '../../src/helpers.js'; import { AlbSchema } from '../../src/schemas/alb.js'; diff --git a/packages/parser/tests/unit/parser.decorator.test.ts b/packages/parser/tests/unit/parser.decorator.test.ts index ef87d96765..7e0a3d3293 100644 --- a/packages/parser/tests/unit/parser.decorator.test.ts +++ b/packages/parser/tests/unit/parser.decorator.test.ts @@ -1,12 +1,7 @@ -/** - * Test decorator parser - * - * @group unit/parser - */ - import { generateMock } from '@anatine/zod-mock'; import type { LambdaInterface } from '@aws-lambda-powertools/commons/lib/esm/types'; import type { Context } from 'aws-lambda'; +import { describe, expect, it } from 'vitest'; import type { z } from 'zod'; import { EventBridgeEnvelope } from '../../src/envelopes/index.js'; import { ParseError } from '../../src/errors.js'; diff --git a/packages/parser/tests/unit/parser.middy.test.ts b/packages/parser/tests/unit/parser.middy.test.ts index 32d13ad05e..0528f71737 100644 --- a/packages/parser/tests/unit/parser.middy.test.ts +++ b/packages/parser/tests/unit/parser.middy.test.ts @@ -1,12 +1,7 @@ -/** - * Test middleware parser - * - * @group unit/parser - */ - import { generateMock } from '@anatine/zod-mock'; import middy from '@middy/core'; import type { Context } from 'aws-lambda'; +import { describe, expect, it } from 'vitest'; import type { ZodSchema, z } from 'zod'; import { ParseError } from '../../src'; import { EventBridgeEnvelope, SqsEnvelope } from '../../src/envelopes'; diff --git a/packages/parser/tests/unit/schema/alb.test.ts b/packages/parser/tests/unit/schema/alb.test.ts index 1d9a21c67e..2e71f92438 100644 --- a/packages/parser/tests/unit/schema/alb.test.ts +++ b/packages/parser/tests/unit/schema/alb.test.ts @@ -1,8 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ +import { describe, expect, it } from 'vitest'; import { AlbMultiValueHeadersSchema, AlbSchema } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; diff --git a/packages/parser/tests/unit/schema/apigw.test.ts b/packages/parser/tests/unit/schema/apigw.test.ts index 64a3ea965d..fa205b532b 100644 --- a/packages/parser/tests/unit/schema/apigw.test.ts +++ b/packages/parser/tests/unit/schema/apigw.test.ts @@ -1,8 +1,4 @@ -/** - * Test built-in API Gateway REST schemas - * - * @group unit/parser/schema/apigw - */ +import { describe, expect, it } from 'vitest'; import { APIGatewayProxyEventSchema, APIGatewayRequestAuthorizerEventSchema, diff --git a/packages/parser/tests/unit/schema/apigwv2.test.ts b/packages/parser/tests/unit/schema/apigwv2.test.ts index 73a03a3431..a1ab6874c3 100644 --- a/packages/parser/tests/unit/schema/apigwv2.test.ts +++ b/packages/parser/tests/unit/schema/apigwv2.test.ts @@ -1,8 +1,4 @@ -/** - * Test built-in API Gateway HTTP API (v2) schemas - * - * @group unit/parser/schema/apigwv2 - */ +import { describe, expect, it } from 'vitest'; import { APIGatewayProxyEventV2Schema, APIGatewayRequestAuthorizerEventV2Schema, diff --git a/packages/parser/tests/unit/schema/cloudformation-custom-resource.test.ts b/packages/parser/tests/unit/schema/cloudformation-custom-resource.test.ts index e00530f3bc..445aac7366 100644 --- a/packages/parser/tests/unit/schema/cloudformation-custom-resource.test.ts +++ b/packages/parser/tests/unit/schema/cloudformation-custom-resource.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { CloudFormationCustomResourceCreateSchema, CloudFormationCustomResourceDeleteSchema, diff --git a/packages/parser/tests/unit/schema/cloudwatch.test.ts b/packages/parser/tests/unit/schema/cloudwatch.test.ts index e126bdb7fb..3fd6dc115f 100644 --- a/packages/parser/tests/unit/schema/cloudwatch.test.ts +++ b/packages/parser/tests/unit/schema/cloudwatch.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { CloudWatchLogsSchema } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; diff --git a/packages/parser/tests/unit/schema/dynamodb.test.ts b/packages/parser/tests/unit/schema/dynamodb.test.ts index f0d90fbc5b..a569032836 100644 --- a/packages/parser/tests/unit/schema/dynamodb.test.ts +++ b/packages/parser/tests/unit/schema/dynamodb.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { DynamoDBStreamSchema } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; diff --git a/packages/parser/tests/unit/schema/eventbridge.test.ts b/packages/parser/tests/unit/schema/eventbridge.test.ts index 4423318874..480d7a4030 100644 --- a/packages/parser/tests/unit/schema/eventbridge.test.ts +++ b/packages/parser/tests/unit/schema/eventbridge.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { EventBridgeSchema } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; diff --git a/packages/parser/tests/unit/schema/kafka.test.ts b/packages/parser/tests/unit/schema/kafka.test.ts index 6292f3001f..0c4fe096ba 100644 --- a/packages/parser/tests/unit/schema/kafka.test.ts +++ b/packages/parser/tests/unit/schema/kafka.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { KafkaMskEventSchema, KafkaRecordSchema, diff --git a/packages/parser/tests/unit/schema/kinesis.test.ts b/packages/parser/tests/unit/schema/kinesis.test.ts index f8e7d93608..5ff2453f49 100644 --- a/packages/parser/tests/unit/schema/kinesis.test.ts +++ b/packages/parser/tests/unit/schema/kinesis.test.ts @@ -1,10 +1,5 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - import { gunzipSync } from 'node:zlib'; +import { describe, expect, it } from 'vitest'; import { KinesisDataStreamRecord, KinesisDataStreamSchema, diff --git a/packages/parser/tests/unit/schema/lambda.test.ts b/packages/parser/tests/unit/schema/lambda.test.ts index e9b0a3449b..dfce359967 100644 --- a/packages/parser/tests/unit/schema/lambda.test.ts +++ b/packages/parser/tests/unit/schema/lambda.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { LambdaFunctionUrlSchema } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; diff --git a/packages/parser/tests/unit/schema/s3.test.ts b/packages/parser/tests/unit/schema/s3.test.ts index 8798155472..dcc3a7918e 100644 --- a/packages/parser/tests/unit/schema/s3.test.ts +++ b/packages/parser/tests/unit/schema/s3.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { S3EventNotificationEventBridgeSchema, S3ObjectLambdaEventSchema, diff --git a/packages/parser/tests/unit/schema/ses.test.ts b/packages/parser/tests/unit/schema/ses.test.ts index 7c27a83d97..67ee78ac95 100644 --- a/packages/parser/tests/unit/schema/ses.test.ts +++ b/packages/parser/tests/unit/schema/ses.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { SesRecordSchema, SesSchema } from '../../../src/schemas/'; import type { SesEvent } from '../../../src/types'; import type { SesRecord } from '../../../src/types/schema'; diff --git a/packages/parser/tests/unit/schema/sns.test.ts b/packages/parser/tests/unit/schema/sns.test.ts index 7ddb7f1132..8ea5bde8fc 100644 --- a/packages/parser/tests/unit/schema/sns.test.ts +++ b/packages/parser/tests/unit/schema/sns.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { SnsNotificationSchema, SnsRecordSchema, diff --git a/packages/parser/tests/unit/schema/sqs.test.ts b/packages/parser/tests/unit/schema/sqs.test.ts index 9514338395..7e52ce99ef 100644 --- a/packages/parser/tests/unit/schema/sqs.test.ts +++ b/packages/parser/tests/unit/schema/sqs.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { SqsRecordSchema, SqsSchema } from '../../../src/schemas/'; import type { SqsEvent } from '../../../src/types'; import type { SqsRecord } from '../../../src/types/schema'; diff --git a/packages/parser/tests/unit/schema/utils.ts b/packages/parser/tests/unit/schema/utils.ts index cb0647aed7..aa5c9ab531 100644 --- a/packages/parser/tests/unit/schema/utils.ts +++ b/packages/parser/tests/unit/schema/utils.ts @@ -102,7 +102,10 @@ const filenames = [ type TestEvents = { [K in (typeof filenames)[number]]: unknown }; const loadFileContent = (filename: string): string => - readFileSync(`./tests/events/${filename}.json`, 'utf-8'); + readFileSync( + join(__dirname, '..', '..', 'events', `${filename}.json`), + 'utf-8' + ); const createTestEvents = (fileList: readonly string[]): TestEvents => { const testEvents: Partial = {}; diff --git a/packages/parser/tests/unit/schema/vpc-lattice.test.ts b/packages/parser/tests/unit/schema/vpc-lattice.test.ts index 643714fb47..472e6514e6 100644 --- a/packages/parser/tests/unit/schema/vpc-lattice.test.ts +++ b/packages/parser/tests/unit/schema/vpc-lattice.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { VpcLatticeSchema } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; diff --git a/packages/parser/tests/unit/schema/vpc-latticev2.test.ts b/packages/parser/tests/unit/schema/vpc-latticev2.test.ts index 5e1b6c7343..5c731a3a70 100644 --- a/packages/parser/tests/unit/schema/vpc-latticev2.test.ts +++ b/packages/parser/tests/unit/schema/vpc-latticev2.test.ts @@ -1,9 +1,4 @@ -/** - * Test built in schema - * - * @group unit/parser/schema/ - */ - +import { describe, expect, it } from 'vitest'; import { VpcLatticeV2Schema } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; diff --git a/packages/parser/vitest.config.ts b/packages/parser/vitest.config.ts new file mode 100644 index 0000000000..9f1196ef1f --- /dev/null +++ b/packages/parser/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineProject } from 'vitest/config'; + +export default defineProject({ + test: { + environment: 'node', + setupFiles: ['../testing/src/setupEnv.ts'], + }, +}); diff --git a/vitest.config.ts b/vitest.config.ts index 5bbd1d007c..5f320c2df3 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -21,7 +21,8 @@ export default defineConfig({ 'packages/logger/src/types/**', 'packages/metrics/**', 'packages/parameters/**', - 'packages/parser/**', + 'packages/parser/src/types/**', + 'layers/**', 'packages/testing/**', 'packages/tracer/src/types/**', ],