Skip to content

Commit 455d7b9

Browse files
authored
test(jmespath): switch tests to vitest (#3079)
1 parent e7a8c8c commit 455d7b9

23 files changed

+34
-128
lines changed

.github/workflows/reusable-run-linting-check-and-unit-tests.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ jobs:
4040
strategy:
4141
matrix:
4242
version: [18, 20]
43-
workspace: ["packages/batch", "packages/commons"]
43+
workspace: [
44+
"packages/batch",
45+
"packages/commons",
46+
"packages/jmespath"
47+
]
4448
fail-fast: false
4549
steps:
4650
- name: Checkout code
@@ -82,14 +86,11 @@ jobs:
8286
nodeVersion: ${{ matrix.version }}
8387
- name: Run linting
8488
run: |
85-
npm run lint -w packages/commons \
86-
-w packages/logger \
89+
npm run lint -w packages/logger \
8790
-w packages/tracer \
8891
-w packages/metrics \
8992
-w packages/parameters \
9093
-w packages/idempotency \
91-
-w packages/batch \
92-
-w packages/jmespath \
9394
-w packages/parser \
9495
-w packages/event-handler
9596
- name: Run unit tests
@@ -99,8 +100,6 @@ jobs:
99100
-w packages/metrics \
100101
-w packages/parameters \
101102
-w packages/idempotency \
102-
-w packages/batch \
103-
-w packages/jmespath \
104103
-w packages/parser \
105104
-w packages/event-handler
106105
check-examples:

.husky/pre-push

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
npm t \
2-
-w packages/jmespath \
32
-w packages/logger \
43
-w packages/metrics \
54
-w packages/tracer \

packages/jmespath/jest.config.cjs

-34
This file was deleted.

packages/jmespath/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
"access": "public"
1111
},
1212
"scripts": {
13-
"test": "npm run test:unit",
14-
"test:unit": "jest --group=unit --detectOpenHandles --coverage",
15-
"jest": "jest --detectOpenHandles --verbose",
13+
"test": "vitest --run",
14+
"test:unit": "vitest --run",
15+
"test:unit:coverage": "vitest --run tests/unit --coverage.enabled --coverage.thresholds.100 --coverage.include='src/**'",
16+
"test:unit:types": "echo 'Not applicable for this package'",
1617
"test:e2e": "echo 'Not applicable for this package'",
17-
"watch": "jest --watch --group=unit",
1818
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
1919
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
2020
"build": "npm run build:esm & npm run build:cjs",

packages/jmespath/tests/helpers/populateEnvironmentVariables.ts

-1
This file was deleted.

packages/jmespath/tests/unit/compliance/base.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/base
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Base tests', () => {

packages/jmespath/tests/unit/compliance/boolean.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/boolean
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Boolean tests', () => {

packages/jmespath/tests/unit/compliance/current.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/current
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Current operator tests', () => {

packages/jmespath/tests/unit/compliance/escape.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/escape
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Escape characters tests', () => {

packages/jmespath/tests/unit/compliance/filters.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/filters
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Filer operator tests', () => {

packages/jmespath/tests/unit/compliance/functions.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/functions
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Functions tests', () => {

packages/jmespath/tests/unit/compliance/identifiers.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/identifiers
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Identifiers tests', () => {

packages/jmespath/tests/unit/compliance/indices.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/indices
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Indices tests', () => {

packages/jmespath/tests/unit/compliance/literal.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/literal
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Literal expressions tests', () => {

packages/jmespath/tests/unit/compliance/multiselect.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/multiselect
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Multiselect expressions tests', () => {

packages/jmespath/tests/unit/compliance/pipe.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/pipe
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Pipe expressions tests', () => {

packages/jmespath/tests/unit/compliance/slice.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/slice
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Slices tests', () => {

packages/jmespath/tests/unit/compliance/syntax.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/syntax
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Syntax tests', () => {

packages/jmespath/tests/unit/compliance/unicode.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/unicode
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Unicode tests', () => {

packages/jmespath/tests/unit/compliance/wildcard.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/compliance/wildcard
5-
*/
1+
import { describe, expect, it } from 'vitest';
62
import { search } from '../../../src/index.js';
73

84
describe('Wildcard tests', () => {

packages/jmespath/tests/unit/index.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
/**
2-
* Test Compliance with the JMESPath specification
3-
*
4-
* @group unit/jmespath/coverage
5-
*/
61
import { brotliDecompressSync } from 'node:zlib';
72
import { fromBase64 } from '@aws-lambda-powertools/commons/utils/base64';
3+
import { describe, expect, it } from 'vitest';
84
import { Functions } from '../../src/Functions.js';
95
import { Parser } from '../../src/Parser.js';
106
import { PowertoolsFunctions } from '../../src/PowertoolsFunctions.js';

packages/jmespath/vitest.config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineProject } from 'vitest/config';
2+
3+
export default defineProject({
4+
test: {
5+
environment: 'node',
6+
},
7+
});

vitest.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default defineConfig({
1717
'packages/commons/src/types/**',
1818
'packages/event-handler/**',
1919
'packages/idempotency/**',
20-
'packages/jmespath/**',
20+
'packages/jmespath/src/types.ts',
2121
'packages/logger/**',
2222
'packages/metrics/**',
2323
'packages/parameters/**',

0 commit comments

Comments
 (0)