From 8cfe978da509a84f0b414ca3dcfda2e37b9f6574 Mon Sep 17 00:00:00 2001 From: Alex Freska Date: Thu, 22 Feb 2024 10:01:42 -0500 Subject: [PATCH] chore: class private method support to jest --- apps/explorer/jest.config.ts | 8 +++++++- apps/hostd/jest.config.ts | 8 +++++++- apps/renterd/jest.config.ts | 8 +++++++- apps/walletd/jest.config.ts | 8 +++++++- apps/website/jest.config.ts | 8 +++++++- libs/design-system/jest.config.ts | 9 ++++++++- libs/fonts/jest.config.ts | 9 ++++++++- libs/next/jest.config.ts | 9 ++++++++- libs/react-core/jest.config.ts | 9 ++++++++- libs/react-hostd/jest.config.ts | 9 ++++++++- libs/react-icons/jest.config.ts | 9 ++++++++- libs/react-renterd/jest.config.ts | 9 ++++++++- libs/react-sia-central/jest.config.ts | 9 ++++++++- libs/react-walletd/jest.config.ts | 9 ++++++++- libs/sdk/jest.config.ts | 9 ++++++++- libs/sia-central/jest.config.ts | 9 ++++++++- libs/types/jest.config.ts | 9 ++++++++- libs/units/jest.config.ts | 9 ++++++++- 18 files changed, 139 insertions(+), 18 deletions(-) diff --git a/apps/explorer/jest.config.ts b/apps/explorer/jest.config.ts index 04a9dca75..757e07a04 100644 --- a/apps/explorer/jest.config.ts +++ b/apps/explorer/jest.config.ts @@ -4,7 +4,13 @@ export default { preset: '../../jest.preset.js', transform: { '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }], + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/apps/explorer', diff --git a/apps/hostd/jest.config.ts b/apps/hostd/jest.config.ts index 93e69a59f..cf77a1a10 100644 --- a/apps/hostd/jest.config.ts +++ b/apps/hostd/jest.config.ts @@ -4,7 +4,13 @@ export default { preset: '../../jest.preset.js', transform: { '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }], + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/apps/hostd', diff --git a/apps/renterd/jest.config.ts b/apps/renterd/jest.config.ts index 79a400a97..ad2c1cbec 100644 --- a/apps/renterd/jest.config.ts +++ b/apps/renterd/jest.config.ts @@ -4,7 +4,13 @@ export default { preset: '../../jest.preset.js', transform: { '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }], + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/apps/renterd', diff --git a/apps/walletd/jest.config.ts b/apps/walletd/jest.config.ts index 70ac17091..1e6c79b1c 100644 --- a/apps/walletd/jest.config.ts +++ b/apps/walletd/jest.config.ts @@ -4,7 +4,13 @@ export default { preset: '../../jest.preset.js', transform: { '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }], + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/apps/walletd', diff --git a/apps/website/jest.config.ts b/apps/website/jest.config.ts index 8fc721897..f5fb90882 100644 --- a/apps/website/jest.config.ts +++ b/apps/website/jest.config.ts @@ -3,7 +3,13 @@ export default { displayName: 'website', transform: { '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }], + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/apps/website', diff --git a/libs/design-system/jest.config.ts b/libs/design-system/jest.config.ts index 828fd3e75..2c489c35e 100644 --- a/libs/design-system/jest.config.ts +++ b/libs/design-system/jest.config.ts @@ -2,7 +2,14 @@ export default { displayName: 'design-system', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/design-system', diff --git a/libs/fonts/jest.config.ts b/libs/fonts/jest.config.ts index f290f420b..0a7d90078 100644 --- a/libs/fonts/jest.config.ts +++ b/libs/fonts/jest.config.ts @@ -2,7 +2,14 @@ export default { displayName: 'fonts', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/fonts', diff --git a/libs/next/jest.config.ts b/libs/next/jest.config.ts index 33b863a36..e7132bbbf 100644 --- a/libs/next/jest.config.ts +++ b/libs/next/jest.config.ts @@ -3,7 +3,14 @@ export default { displayName: 'next', preset: '../../jest.preset.js', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/next', diff --git a/libs/react-core/jest.config.ts b/libs/react-core/jest.config.ts index cbac7a038..0547e2d7f 100644 --- a/libs/react-core/jest.config.ts +++ b/libs/react-core/jest.config.ts @@ -3,7 +3,14 @@ export default { displayName: 'react-core', preset: '../../jest.preset.js', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/react-core', diff --git a/libs/react-hostd/jest.config.ts b/libs/react-hostd/jest.config.ts index dde8339f2..db9792974 100644 --- a/libs/react-hostd/jest.config.ts +++ b/libs/react-hostd/jest.config.ts @@ -3,7 +3,14 @@ export default { displayName: 'react-hostd', preset: '../../jest.preset.js', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/react-hostd', diff --git a/libs/react-icons/jest.config.ts b/libs/react-icons/jest.config.ts index d8dc6ef9f..1dec75131 100644 --- a/libs/react-icons/jest.config.ts +++ b/libs/react-icons/jest.config.ts @@ -2,7 +2,14 @@ export default { displayName: 'react-icons', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/react-icons', diff --git a/libs/react-renterd/jest.config.ts b/libs/react-renterd/jest.config.ts index 8e253ee52..b7bb28c47 100644 --- a/libs/react-renterd/jest.config.ts +++ b/libs/react-renterd/jest.config.ts @@ -3,7 +3,14 @@ export default { displayName: 'react-renterd', preset: '../../jest.preset.js', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/react-renterd', diff --git a/libs/react-sia-central/jest.config.ts b/libs/react-sia-central/jest.config.ts index c7c88e2d9..984ab214d 100644 --- a/libs/react-sia-central/jest.config.ts +++ b/libs/react-sia-central/jest.config.ts @@ -3,7 +3,14 @@ export default { displayName: 'react-sia-central', preset: '../../jest.preset.js', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/react-sia-central', diff --git a/libs/react-walletd/jest.config.ts b/libs/react-walletd/jest.config.ts index a58f3cb9f..436d4797c 100644 --- a/libs/react-walletd/jest.config.ts +++ b/libs/react-walletd/jest.config.ts @@ -3,7 +3,14 @@ export default { displayName: 'react-walletd', preset: '../../jest.preset.js', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/react-walletd', diff --git a/libs/sdk/jest.config.ts b/libs/sdk/jest.config.ts index 01c310cb5..9777c0afd 100644 --- a/libs/sdk/jest.config.ts +++ b/libs/sdk/jest.config.ts @@ -3,7 +3,14 @@ export default { displayName: 'sdk', preset: '../../jest.preset.js', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/sdk', diff --git a/libs/sia-central/jest.config.ts b/libs/sia-central/jest.config.ts index 9126cb39a..e355f2554 100644 --- a/libs/sia-central/jest.config.ts +++ b/libs/sia-central/jest.config.ts @@ -3,7 +3,14 @@ export default { displayName: 'sia-central', preset: '../../jest.preset.js', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/sia-central', diff --git a/libs/types/jest.config.ts b/libs/types/jest.config.ts index 7a7b41544..eb9953526 100644 --- a/libs/types/jest.config.ts +++ b/libs/types/jest.config.ts @@ -3,7 +3,14 @@ export default { displayName: 'types', preset: '../../jest.preset.js', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/types', diff --git a/libs/units/jest.config.ts b/libs/units/jest.config.ts index e014298d9..7ebfd9bc1 100644 --- a/libs/units/jest.config.ts +++ b/libs/units/jest.config.ts @@ -3,7 +3,14 @@ export default { displayName: 'units', preset: '../../jest.preset.js', transform: { - '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', + '^.+\\.[tj]sx?$': [ + 'babel-jest', + { + presets: ['@nx/next/babel'], + plugins: ['@babel/plugin-transform-private-methods'], + }, + ], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/units',