fix(deps): move file-type to deps (#6171)

This commit is contained in:
Elliot DeNolf
2024-05-01 12:20:45 -04:00
committed by GitHub
parent c6132df866
commit 1c490aee42
4 changed files with 86 additions and 13 deletions

View File

@@ -1,3 +1,20 @@
/**
* Ignores all ESM packages that make Jest mad.
*
* "Jest encountered an unexpected token"
*
* Direct packages:
* - file-type
*/
const esModules = [
// file-type and all dependencies: https://github.com/sindresorhus/file-type
'file-type',
'strtok3',
'readable-web-to-node-stream',
'token-types',
'peek-readable',
].join('|')
/** @type {import('jest').Config} */
const baseJestConfig = {
extensionsToTreatAsEsm: ['.ts', '.tsx'],
@@ -14,6 +31,10 @@ const baseJestConfig = {
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest'],
},
transformIgnorePatterns: [
`/node_modules/(?!.pnpm)(?!(${esModules})/)`,
`/node_modules/.pnpm/(?!(${esModules.replace(/\//g, '\\+')})@)`,
],
verbose: true,
}