Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: removed bable in favor of ts-jest #946

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 0 additions & 74 deletions .eslintrc

This file was deleted.

17 changes: 13 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: [16.x, 18.x, 20.x]
os: [ubuntu-latest, windows-latest]
node: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v3

Expand All @@ -31,8 +31,17 @@ jobs:
- name: Install packages
run: npm install

- name: Compile, Test
run: npm run compile && npm run test -- --coverage --verbose --maxWorkers=1
# Run lint before building to prevent eslint from checking the compiled files
- name: Lint
run: npm run lint

- name: Compile
run: npm run compile

- name: Test
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: npm run test

- name: Run codecov
uses: codecov/codecov-action@v3
Expand Down
25 changes: 0 additions & 25 deletions babel.config.js

This file was deleted.

41 changes: 41 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// eslint-disable-next-line n/no-extraneous-import
import globals from 'globals';
import vonage from '@vonage/eslint-config';

export default [
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.node,
...globals.jest,
}
},
},
{
files: ['packages/*/lib/**/*.{ts,tsx}'],
},
{
ignores: ['packages/*/dist/**/*.js', 'coverage/**'],
},
...vonage.configs.typescript,
...vonage.configs.jest,
...vonage.configs.node,
{
settings: {
node: {
version: '>=18.0.0',
}
},
rules: {
// Leave this off. This rule cannot handle monorepos
'n/no-missing-import': ['off'],
'n/no-unsupported-features/es-builtins': [
'error', {
'ignores': []
}]
},
},

];
38 changes: 35 additions & 3 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,140 +1,172 @@
// eslint-disable-next-line n/no-extraneous-import
import type { Config } from '@jest/types';

const projectDefault = {
testEnvironment: 'node',
preset: 'ts-jest/presets/default-esm',
moduleNameMapper: {
'@vonage/(.+)': '<rootDir>/packages/$1/lib',
},
};

const config: Config.InitialOptions = {
extensionsToTreatAsEsm: ['.ts'],
coverageDirectory: '<rootDir>/coverage/',
coveragePathIgnorePatterns: [
'node_modules',
'<rootDir>/testHelpers/*',
'<rootDir>/packages/**/__tests__',
],
projects: [
{
...projectDefault,
displayName: 'ACCOUNTS',
testMatch: ['<rootDir>/packages/accounts/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'APPLICATIONS',
testMatch: ['<rootDir>/packages/applications/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'AUDIT',
testMatch: ['<rootDir>/packages/audit/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'AUTH',
testMatch: ['<rootDir>/packages/auth/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'CONVERSATIONS',
testMatch: ['<rootDir>/packages/conversations/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'JWT',
testMatch: ['<rootDir>/packages/jwt/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'MEDIA',
testMatch: ['<rootDir>/packages/media/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'MESSAGES',
testMatch: ['<rootDir>/packages/messages/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'MEETINGS',
testMatch: ['<rootDir>/packages/meetings/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'NUMBER INSIGHT V2',
testMatch: [
'<rootDir>/packages/number-insight-v2/__tests__/**/*.test.ts',
],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'NUMBER INSIGHTS',
testMatch: ['<rootDir>/packages/number-insights/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'NUMBERS',
testMatch: ['<rootDir>/packages/numbers/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'PRICING',
testMatch: ['<rootDir>/packages/pricing/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'PROACTIVE CONNECT',
testMatch: [
'<rootDir>/packages/proactive-connect/__tests__/**/*.test.ts',
],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'REDACT',
testMatch: ['<rootDir>/packages/redact/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'SERVER CLIENT',
testMatch: ['<rootDir>/packages/server-client/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'SERVER SDK',
testMatch: ['<rootDir>/packages/server-sdk/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'SMS',
testMatch: ['<rootDir>/packages/sms/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'SUB ACCOUNTS',
testMatch: ['<rootDir>/packages/subaccounts/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'USER',
testMatch: ['<rootDir>/packages/users/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'VERIFY',
testMatch: ['<rootDir>/packages/verify/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'VERIFY 2',
testMatch: ['<rootDir>/packages/verify2/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'VIDEO',
testMatch: ['<rootDir>/packages/video/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
{
...projectDefault,
displayName: 'VOICE',
testMatch: ['<rootDir>/packages/voice/__tests__/**/*.test.ts'],
coveragePathIgnorePatterns: ['node_modules', '__tests__'],
},
],
moduleNameMapper: {
'@vonage/(.+)': '<rootDir>/packages/$1/lib',
},
};

export default config;
Loading
Loading