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

Update dependency ts-jest to v28.0.8 #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Mar 20, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
ts-jest (source) 28.0.5 -> 28.0.8 age adoption passing confidence

Release Notes

kulshekhar/ts-jest (ts-jest)

v28.0.8

Compare Source

Bug Fixes

v28.0.7

Compare Source

Bug Fixes

v28.0.6

Compare Source

Bug Fixes

Configuration

📅 Schedule: Branch creation - "* 0-12 * * 3" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/ts-jest-28.x branch from 0db1d84 to 38557e2 Compare May 28, 2024 13:49
@renovate renovate bot force-pushed the renovate/ts-jest-28.x branch 2 times, most recently from 67e048e to d012e99 Compare August 15, 2024 17:33
@renovate renovate bot requested review from emerick and zenparsing as code owners August 15, 2024 17:33
@renovate renovate bot force-pushed the renovate/ts-jest-28.x branch 4 times, most recently from 8d6caab to 391a7b7 Compare September 3, 2024 16:10
@renovate renovate bot force-pushed the renovate/ts-jest-28.x branch from 391a7b7 to bd39437 Compare September 17, 2024 18:24
@renovate renovate bot force-pushed the renovate/ts-jest-28.x branch from bd39437 to 7f149e2 Compare December 19, 2024 16:41
Copy link

[puLL-Merge] - kulshekhar/[email protected]

Diff
diff --git .github/workflows/ci.yml .github/workflows/ci.yml
index bb4a85655e..38cc497d8c 100644
--- .github/workflows/ci.yml
+++ .github/workflows/ci.yml
@@ -9,102 +9,71 @@ on:
       - '**'
 
 concurrency:
-  group: ci-${{ github.event.pull_request.number || github.ref }}
+  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
   cancel-in-progress: true
 
 permissions:
   contents: read
 
 jobs:
-  cleanup-runs:
-    permissions:
-      actions: write # for rokroskar/workflow-run-cleanup-action to obtain workflow name & cancel it
-      contents: read # for rokroskar/workflow-run-cleanup-action to obtain branch
-    runs-on: ubuntu-latest
-    steps:
-      - uses: rokroskar/workflow-run-cleanup-action@master
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-    if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
+  prepare-npm-cache-ubuntu:
+    uses: ./.github/workflows/prepare-cache.yml
+    with:
+      os: ubuntu-latest
+  prepare-npm-cache-windows:
+    uses: ./.github/workflows/prepare-cache.yml
+    with:
+      os: windows-latest
 
-  prepare-npm-cache:
+  lint:
     runs-on: ubuntu-latest
+    needs: prepare-npm-cache-ubuntu
 
     steps:
       - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
-      - uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3.3.0
+      - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
         with:
-          node-version: 16.x
+          node-version: lts/*
           cache: npm
-      - name: Validate cache
+      - name: install
         run: npm ci
+      - name: run eslint
+        run: npm run lint
+      - name: run prettier
+        run: npm run lint-prettier-ci
 
-  lint-and-typecheck:
-    name: build-lint
+  npm-validate:
+    name: validate NPM dependencies
     runs-on: ubuntu-latest
-    needs: prepare-npm-cache
-
+    needs: prepare-npm-cache-ubuntu
     steps:
       - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
-      - uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3.3.0
+      - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
         with:
-          node-version: 16.x
+          node-version: lts/*
           cache: npm
-      - name: Install
-        run: npm ci
-      - name: Run eslint
-        run: npm run lint
-      - name: Run prettier
-        run: npm run lint-prettier-ci
 
-  test:
+  test-ubuntu:
     permissions:
       checks: write # for coverallsapp/github-action to create new checks
       contents: read # for actions/checkout to fetch code
-    name: Node v${{ matrix.node-version }} on ${{ matrix.os }}
-    strategy:
-      fail-fast: false
-      matrix:
-        node-version: [12.x, 14.x, 16.x]
-        os: [ubuntu-latest, windows-latest]
-    runs-on: ${{ matrix.os }}
-    needs: prepare-npm-cache
-
-    steps:
-      - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
-      - name: Get npm cache
-        id: npm-cache
-        run: echo "::set-output name=dir::$(npm config get cacheFolder)"
-      - uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # tag=v3
-        with:
-          path: ${{ steps.npm-cache.outputs.dir }}
-          key: ${{ runner.os }}-node-${{ matrix.node-version }}-npm-${{ hashFiles('**/package-lock.json') }}
-          restore-keys: |
-            ${{ runner.os }}-node-${{ matrix.node-version }}-npm-
-      - name: Use Node.js ${{ matrix.node-version }}
-        uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3.3.0
-        with:
-          node-version: ${{ matrix.node-version }}
-      - name: Install and build
-        run: npm ci
-      - name: Run tests with coverage
-        run: npm run test -- --coverage && cat ./coverage/lcov.info
-        env:
-          CI: true
-          DISABLE_MOCKED_WARNING: true
-      - name: Coveralls parallel
-        uses: coverallsapp/github-action@master
-        with:
-          github-token: ${{ secrets.github_token }}
-          flag-name: run-${{ matrix.node-version }}
-          parallel: true
-      - name: Run tests in example projects
-        run: npm run test-examples
+    uses: ./.github/workflows/test.yml
+    needs: prepare-npm-cache-ubuntu
+    with:
+      os: ubuntu-latest
+  test-windows:
+    permissions:
+      checks: write # for coverallsapp/github-action to create new checks
+      contents: read # for actions/checkout to fetch code
+    uses: ./.github/workflows/test.yml
+    needs: prepare-npm-cache-windows
+    with:
+      os: windows-latest
 
   finish:
     permissions:
       checks: write # for coverallsapp/github-action to create new checks
-    needs: test
+    needs: test-ubuntu
     runs-on: ubuntu-latest
     steps:
       - name: Coveralls finished
diff --git .github/workflows/doc-generator.yml .github/workflows/doc-generator.yml
index 2e2bd908c7..572552b203 100644
--- .github/workflows/doc-generator.yml
+++ .github/workflows/doc-generator.yml
@@ -49,7 +49,7 @@ jobs:
           npm run build
 
       - name: Deploy 🚀
-        uses: JamesIves/github-pages-deploy-action@8817a56e5bfec6e2b08345c81f4d422db53a2cdc # tag=v4.3.3
+        uses: JamesIves/github-pages-deploy-action@13046b614c663b56cba4dda3f30b9736a748b80d # tag=v4.4.0
         with:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           BRANCH: gh-pages # The branch the action should deploy to.
diff --git a/.github/workflows/prepare-cache.yml b/.github/workflows/prepare-cache.yml
new file mode 100644
index 0000000000..5fac3c6c75
--- /dev/null
+++ .github/workflows/prepare-cache.yml
@@ -0,0 +1,22 @@
+name: Prepare CI cache
+
+on:
+  workflow_call:
+    inputs:
+      os:
+        required: true
+        type: string
+
+jobs:
+  prepare-npm-cache:
+    name: Prepare npm cache for ${{ inputs.os }}
+    runs-on: ${{ inputs.os }}
+
+    steps:
+      - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
+      - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
+        with:
+          node-version: lts/*
+          cache: npm
+      - name: Validate cache
+        run: npm ci
diff --git .github/workflows/release-and-publish.yml .github/workflows/release-and-publish.yml
index 151225ce92..8444bc3287 100644
--- .github/workflows/release-and-publish.yml
+++ .github/workflows/release-and-publish.yml
@@ -52,15 +52,13 @@ jobs:
 
         # Runs a single command using the runners shell
       - name: Create release for tag
-        uses: actions/create-release@latest
-        env:
-          # this is provided by github, you don't need to do anything here
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # tag=v1
         with:
           tag_name: ${{ github.ref }}
-          release_name: ${{ github.ref }}
+          body: Please refer to [CHANGELOG.md](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md) for details.
           draft: false
           prerelease: ${{ needs.setup_variables.outputs.isLatest != 'true' }}
+          token: ${{ secrets.GITHUB_TOKEN }}
 
   publish_to_npm:
     needs: [setup_variables, create_release]
@@ -70,9 +68,9 @@ jobs:
       # https://github.com/marketplace/actions/checkout
       - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
       # https://github.com/marketplace/actions/setup-node-js-environment
-      - uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3.3.0
+      - uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3.4.1
         with:
-          node-version: 12
+          node-version: 16
           registry-url: https://registry.npmjs.org/
       - name: Check lock file
         # runs npm install using package-lock.json and verifies
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000000..c0feb6506a
--- /dev/null
+++ .github/workflows/test.yml
@@ -0,0 +1,40 @@
+name: Test
+
+on:
+  workflow_call:
+    inputs:
+      os:
+        required: true
+        type: string
+
+jobs:
+  test:
+    strategy:
+      fail-fast: false
+      matrix:
+        node-version: [12.x, 14.x, 16.x]
+    name: Node v${{ matrix.node-version }} on ${{ inputs.os }}
+    runs-on: ${{ inputs.os }}
+
+    steps:
+      - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
+      - name: Use Node.js ${{ matrix.node-version }}
+        uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
+        with:
+          node-version: ${{ matrix.node-version }}
+          cache: npm
+      - name: Install and build
+        run: npm ci
+      - name: Run tests with coverage
+        run: npm run test -- --coverage && cat ./coverage/lcov.info
+        env:
+          CI: true
+          DISABLE_MOCKED_WARNING: true
+      - name: Coveralls parallel
+        uses: coverallsapp/github-action@master
+        with:
+          github-token: ${{ secrets.github_token }}
+          flag-name: run-${{ matrix.node-version }}
+          parallel: true
+      - name: Run tests in example projects
+        run: npm run test-examples
diff --git .npmignore .npmignore
index cff8c5d0f1..da8e69e1a9 100644
--- .npmignore
+++ .npmignore
@@ -57,6 +57,7 @@ node_modules
 icon.png
 .idea
 .husky
+renovate.json
 
 # ensure we do not omit the digest
 !.ts-jest-digest
diff --git CHANGELOG.md CHANGELOG.md
index f3a48e56d2..7470cd4af1 100644
--- CHANGELOG.md
+++ CHANGELOG.md
@@ -1,3 +1,32 @@
+## [28.0.8](https://github.com/kulshekhar/ts-jest/compare/v28.0.7...v28.0.8) (2022-08-14)
+
+
+### Bug Fixes
+
+* allow `.mts` to be processed ([#3713](https://github.com/kulshekhar/ts-jest/issues/3713)) ([effae71](https://github.com/kulshekhar/ts-jest/commit/effae717369860e16cb0ccbf24027651493b9bf1)), closes [#3702](https://github.com/kulshekhar/ts-jest/issues/3702)
+
+
+
+## [28.0.7](https://github.com/kulshekhar/ts-jest/compare/v28.0.6...v28.0.7) (2022-07-15)
+
+
+### Bug Fixes
+
+* update `@jest/types` to be an optional peer dependency ([#3690](https://github.com/kulshekhar/ts-jest/issues/3690)) ([8a8c3fa](https://github.com/kulshekhar/ts-jest/commit/8a8c3fafecffd19380171c661e94246024cae2ff)), closes [#3689](https://github.com/kulshekhar/ts-jest/issues/3689)
+
+
+
+## [28.0.6](https://github.com/kulshekhar/ts-jest/compare/v28.0.5...v28.0.6) (2022-07-13)
+
+
+### Bug Fixes
+
+* **config:** don't show diagnostics warning with `diagnostics: false` ([#3647](https://github.com/kulshekhar/ts-jest/issues/3647)) ([9a9bc02](https://github.com/kulshekhar/ts-jest/commit/9a9bc02935968fb5eb9fd3614a1f7cce019b80d8)), closes [#3638](https://github.com/kulshekhar/ts-jest/issues/3638)
+* **legacy:** add `useCaseSensitiveFileNames` wherever needed ([#3683](https://github.com/kulshekhar/ts-jest/issues/3683)) ([c40bc34](https://github.com/kulshekhar/ts-jest/commit/c40bc34625d63cccc0db7296e616af27868fe1fe)), closes [#3665](https://github.com/kulshekhar/ts-jest/issues/3665)
+* set `@jest/types` as peer dependency ([#3633](https://github.com/kulshekhar/ts-jest/issues/3633)) ([24567e1](https://github.com/kulshekhar/ts-jest/commit/24567e13d2780ad8a11c7ff35f9151ec53f8c211))
+
+
+
 ## [28.0.5](https://github.com/kulshekhar/ts-jest/compare/v28.0.4...v28.0.5) (2022-06-11)
 
 
diff --git e2e/__tests__/native-esm-ts.test.ts e2e/__tests__/native-esm-ts.test.ts
index c398640731..50efbe8a41 100644
--- e2e/__tests__/native-esm-ts.test.ts
+++ e2e/__tests__/native-esm-ts.test.ts
@@ -8,7 +8,7 @@ onNodeVersions('>=12.16.0', () => {
     })
 
     expect(exitCode).toBe(0)
-    expect(json.numTotalTests).toBe(2)
-    expect(json.numPassedTests).toBe(2)
+    expect(json.numTotalTests).toBe(3)
+    expect(json.numPassedTests).toBe(3)
   })
 })
diff --git e2e/ast-transformers/hoist-jest/package.json e2e/ast-transformers/hoist-jest/package.json
index aca0d68e24..e6528f28ab 100644
--- e2e/ast-transformers/hoist-jest/package.json
+++ e2e/ast-transformers/hoist-jest/package.json
@@ -1,6 +1,6 @@
 {
   "dependencies": {
-    "react": "^18.1.0"
+    "react": "^18.2.0"
   },
   "jest": {
     "automock": true,
diff --git e2e/ast-transformers/transformer-in-ts/package.json e2e/ast-transformers/transformer-in-ts/package.json
index 9a012fd520..247b073441 100644
--- e2e/ast-transformers/transformer-in-ts/package.json
+++ e2e/ast-transformers/transformer-in-ts/package.json
@@ -1,6 +1,6 @@
 {
   "dependencies": {
-    "esbuild": "~0.14.43"
+    "esbuild": "~0.15.3"
   },
   "jest": {
     "globals": {
diff --git e2e/ast-transformers/transformer-options/package.json e2e/ast-transformers/transformer-options/package.json
index b183784e3d..60cf3c28e4 100644
--- e2e/ast-transformers/transformer-options/package.json
+++ e2e/ast-transformers/transformer-options/package.json
@@ -1,8 +1,8 @@
 {
   "dependencies": {
-    "@formatjs/ts-transformer": "^3.9.8",
-    "react": "^18.1.0",
-    "react-intl": "^6.0.4"
+    "@formatjs/ts-transformer": "^3.9.9",
+    "react": "^18.2.0",
+    "react-intl": "^6.0.5"
   },
   "jest": {
     "globals": {
diff --git e2e/config-typing/package.json e2e/config-typing/package.json
index d7f7e3b9ea..06809ddd3d 100644
--- e2e/config-typing/package.json
+++ e2e/config-typing/package.json
@@ -1,5 +1,5 @@
 {
   "dependencies": {
-    "ts-node": "^10.8.1"
+    "ts-node": "^10.9.1"
   }
 }
diff --git e2e/diagnostics/__tests__/diagnostics.spec.ts e2e/diagnostics/__tests__/diagnostics.spec.ts
index f602e74846..b7cdef9512 100644
--- e2e/diagnostics/__tests__/diagnostics.spec.ts
+++ e2e/diagnostics/__tests__/diagnostics.spec.ts
@@ -1,4 +1,4 @@
-import { Thing } from '../foo'
+import type { Thing } from '../foo'
 
 const thing: Thing = { a: 1 }
 
diff --git e2e/native-esm-ts/__tests__/native-esm-ts.spec.ts e2e/native-esm-ts/__tests__/native-esm-ts.spec.ts
index 8efe1cf53b..22e0000bd2 100644
--- e2e/native-esm-ts/__tests__/native-esm-ts.spec.ts
+++ e2e/native-esm-ts/__tests__/native-esm-ts.spec.ts
@@ -1,9 +1,16 @@
+import { test, expect } from '@jest/globals'
+
 import { double } from '../double'
+import { triple } from '../triple.mjs'
 
 test('double', () => {
   expect(double(2)).toBe(4)
 })
 
+test('triple', () => {
+  expect(triple(2)).toBe(6)
+})
+
 test('import.meta', () => {
   expect(typeof import.meta.url).toBe('string')
 })
diff --git e2e/native-esm-ts/jest-isolated.config.js e2e/native-esm-ts/jest-isolated.config.js
index fa9836cc20..c62cabebf1 100644
--- e2e/native-esm-ts/jest-isolated.config.js
+++ e2e/native-esm-ts/jest-isolated.config.js
@@ -7,7 +7,8 @@ module.exports = {
       useESM: true,
     },
   },
+  resolver: '<rootDir>/mjs-resolver.ts',
   transform: {
-    '^.+.tsx?$': '<rootDir>/../../legacy.js',
+    '^.+\\.m?tsx?$': '<rootDir>/../../legacy.js',
   },
 }
diff --git a/e2e/native-esm-ts/mjs-resolver.ts b/e2e/native-esm-ts/mjs-resolver.ts
new file mode 100644
index 0000000000..707666888d
--- /dev/null
+++ e2e/native-esm-ts/mjs-resolver.ts
@@ -0,0 +1,15 @@
+const mjsResolver = (path, options) => {
+  const mjsExtRegex = /\.mjs$/i
+  const resolver = options.defaultResolver
+  if (mjsExtRegex.test(path)) {
+    try {
+      return resolver(path.replace(mjsExtRegex, '.mts'), options)
+    } catch {
+      // use default resolver
+    }
+  }
+
+  return resolver(path, options)
+}
+
+module.exports = mjsResolver
diff --git a/e2e/native-esm-ts/package-lock.json b/e2e/native-esm-ts/package-lock.json
new file mode 100644
index 0000000000..e3e15f950d
diff --git e2e/native-esm-ts/package.json e2e/native-esm-ts/package.json
index 86ef0d85db..05509bd4ab 100644
--- e2e/native-esm-ts/package.json
+++ e2e/native-esm-ts/package.json
@@ -1,4 +1,8 @@
 {
+  "type": "module",
+  "devDependencies": {
+    "@jest/globals": "^28.1.3"
+  },
   "jest": {
     "extensionsToTreatAsEsm": [".ts"],
     "globals": {
@@ -6,8 +10,9 @@
         "useESM": true
       }
     },
+    "resolver": "<rootDir>/mjs-resolver.ts",
     "transform": {
-      "^.+.tsx?$": "<rootDir>/../../legacy.js"
+      "^.+\\.m?tsx?$": "<rootDir>/../../legacy.js"
     }
   }
 }
diff --git a/e2e/native-esm-ts/triple.mts b/e2e/native-esm-ts/triple.mts
new file mode 100644
index 0000000000..d8cbfa2dd5
--- /dev/null
+++ e2e/native-esm-ts/triple.mts
@@ -0,0 +1,3 @@,
+export function triple(num: number): number {
+  return num * 3
+}
diff --git a/e2e/native-esm-ts/tsconfig.json b/e2e/native-esm-ts/tsconfig.json
new file mode 100644
index 0000000000..a33e7ef827
--- /dev/null
+++ e2e/native-esm-ts/tsconfig.json
@@ -0,0 +1,8 @@
+{
+  "compilerOptions": {
+    "module": "Node16",
+    "target": "ESNext",
+    "moduleResolution": "Node16",
+    "esModuleInterop": true
+  }
+}
diff --git e2e/transform-js/package.json e2e/transform-js/package.json
index 41fb451436..e8727c8d7d 100644
--- e2e/transform-js/package.json
+++ e2e/transform-js/package.json
@@ -1,6 +1,6 @@
 {
   "dependencies": {
-    "@babel/preset-env": "^7.18.2"
+    "@babel/preset-env": "^7.18.10"
   },
   "jest": {
     "projects": [
diff --git e2e/transform-tsx/package.json e2e/transform-tsx/package.json
index 3d1fb5c398..fb2eb51e14 100644
--- e2e/transform-tsx/package.json
+++ e2e/transform-tsx/package.json
@@ -1,13 +1,15 @@
 {
   "dependencies": {
-    "jest-environment-jsdom": "^28.1.1",
-    "react": "^18.1.0",
-    "react-dom": "^18.1.0"
+    "react": "^18.2.0",
+    "react-dom": "^18.2.0"
   },
   "jest": {
     "testEnvironment": "jsdom",
     "transform": {
       "^.+.tsx?$": "<rootDir>/../../legacy.js"
     }
+  },
+  "devDependencies": {
+    "jest-environment-jsdom": "^28.1.3"
   }
 }
diff --git e2e/utils.ts e2e/utils.ts
index ee3e8f1075..725b59e877 100644
--- e2e/utils.ts
+++ e2e/utils.ts
@@ -1,7 +1,6 @@
 import * as path from 'path'
 
-import type { Config } from '@jest/types'
-import { ExecaReturnValue, sync as spawnSync, SyncOptions } from 'execa'
+import { type ExecaReturnValue, sync as spawnSync, type SyncOptions } from 'execa'
 import * as fs from 'graceful-fs'
 
 import { version } from '../package.json'
@@ -12,7 +11,7 @@ interface RunResult extends ExecaReturnValue {
   status: number
   error: Error
 }
-export const run = (cmd: string, cwd?: Config.Path, env?: Record<string, string>): RunResult => {
+export const run = (cmd: string, cwd?: string, env?: Record<string, string>): RunResult => {
   const args = cmd.split(/\s/).slice(1)
   const spawnOptions = { cwd, env, preferLocal: false, reject: false }
   const result = spawnSync(cmd.split(/\s/)[0], args, spawnOptions as SyncOptions) as RunResult
@@ -34,7 +33,7 @@ export const run = (cmd: string, cwd?: Config.Path, env?: Record<string, string>
   return result
 }
 
-export const runNpmInstall = (cwd: Config.Path, env?: Record<string, string>): RunResult => {
+export const runNpmInstall = (cwd: string, env?: Record<string, string>): RunResult => {
   const lockfilePath = path.resolve(cwd, 'package-lock.json')
   let exists = true
 
diff --git examples/js-with-babel/package.json examples/js-with-babel/package.json
index 811eec969e..acecfcb34e 100644
--- examples/js-with-babel/package.json
+++ examples/js-with-babel/package.json
@@ -8,11 +8,11 @@
     "test-esm-isolated": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm-isolated.config.js --no-cache"
   },
   "devDependencies": {
-    "@babel/core": "^7.18.5",
-    "@babel/preset-env": "^7.18.2",
-    "babel-jest": "^28.1.1",
-    "jest": "^28.1.1",
-    "ts-jest": "^28.0.4",
-    "typescript": "~4.7.3"
+    "@babel/core": "^7.18.10",
+    "@babel/preset-env": "^7.18.10",
+    "babel-jest": "^28.1.3",
+    "jest": "^28.1.3",
+    "ts-jest": "^28.0.7",
+    "typescript": "~4.7.4"
   }
 }
diff --git examples/js-with-ts/package.json examples/js-with-ts/package.json
index 2ee45d5e4c..1999087e50 100644
--- examples/js-with-ts/package.json
+++ examples/js-with-ts/package.json
@@ -8,8 +8,8 @@
     "test-esm-isolated": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm-isolated.config.js --no-cache"
   },
   "devDependencies": {
-    "jest": "^28.1.1",
-    "ts-jest": "^28.0.4",
-    "typescript": "~4.7.3"
+    "jest": "^28.1.3",
+    "ts-jest": "^28.0.7",
+    "typescript": "~4.7.4"
   }
 }
diff --git examples/react-app/package.json examples/react-app/package.json
index 26c4becac3..bdf4846e25 100644
--- examples/react-app/package.json
+++, examples/react-app/package.json
@@ -5,7 +5,7 @@
   "dependencies": {
     "@babel/core": "^7.16.0",
     "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
-    "@svgr/webpack": "^5.5.0",
+    "@svgr/webpack": "^6.3.1",
     "@testing-library/jest-dom": "^5.16.1",
     "@testing-library/react": "^12.1.2",
     "@testing-library/user-event": "^13.5.0",
diff --git examples/ts-only/package.json examples/ts-only/package.json
index 53ed86afcc..38b7071a2f 100644
--- examples/ts-only/package.json
+++ examples/ts-only/package.json
@@ -8,8 +8,8 @@
     "test-esm-isolated": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest-esm-isolated.config.js --no-cache"
   },
   "devDependencies": {
-    "jest": "^28.1.1",
-    "ts-jest": "^28.0.4",
-    "typescript": "~4.7.3"
+    "jest": "^28.1.3",
+    "ts-jest": "^28.0.7",
+    "typescript": "~4.7.4"
   }
 }
diff --git jest.config.js jest.config.js
index 509efd3c02..863e7a29af 100644
--- jest.config.js
+++ jest.config.js
@@ -14,4 +14,5 @@ module.exports = {
   transform: {
     '^.+.tsx?$': '<rootDir>/legacy.js',
   },
+  coverageProvider: 'v8',
 }
diff --git package.json package.json
index bcd15bf2ee..78ff09c87f 100644
--- package.json
+++ package.json
@@ -1,6 +1,6 @@
 {
   "name": "ts-jest",
-  "version": "28.0.5",
+  "version": "28.0.8",
   "main": "dist/index.js",
   "types": "dist/index.d.ts",
   "bin": {
@@ -62,6 +62,7 @@
   },
   "peerDependencies": {
     "@babel/core": ">=7.0.0-beta.0 <8",
+    "@jest/types": "^28.0.0",
     "babel-jest": "^28.0.0",
     "jest": "^28.0.0",
     "typescript": ">=4.3"
@@ -70,6 +71,9 @@
     "@babel/core": {
       "optional": true
     },
+    "@jest/types": {
+      "optional": true
+    },
     "babel-jest": {
       "optional": true
     },
@@ -86,9 +90,9 @@
   },
   "devDependencies": {
     "@commitlint/cli": "17.x",
-    "@commitlint/config-angular": "^17.0.0",
-    "@jest/transform": "^28.1.1",
-    "@jest/types": "^28.1.1",
+    "@commitlint/config-angular": "^17.0.3",
+    "@jest/transform": "^28.1.3",
+    "@jest/types": "^28.1.3",
     "@types/babel__core": "7.x",
     "@types/cross-spawn": "latest",
     "@types/fs-extra": "latest",
@@ -104,13 +108,13 @@
     "@types/semver": "latest",
     "@types/yargs": "latest",
     "@types/yargs-parser": "21.x",
-    "@typescript-eslint/eslint-plugin": "^5.27.1",
-    "@typescript-eslint/parser": "^5.27.1",
-    "babel-jest": "^28.1.1",
+    "@typescript-eslint/eslint-plugin": "^5.33.0",
+    "@typescript-eslint/parser": "^5.33.0",
+    "babel-jest": "^28.1.3",
     "conventional-changelog-cli": "2.x",
     "cross-spawn": "latest",
-    "esbuild": "~0.14.43",
-    "eslint": "^8.17.0",
+    "esbuild": "~0.15.3",
+    "eslint": "^8.22.0",
     "eslint-config-prettier": "latest",
     "eslint-plugin-import": "latest",
     "eslint-plugin-jest": "latest",
@@ -122,16 +126,16 @@
     "glob": "^8.0.3",
     "glob-gitignore": "latest",
     "husky": "4.x",
-    "jest": "^28.1.1",
+    "jest": "^28.1.3",
     "jest-snapshot-serializer-raw": "^1.2.0",
     "js-yaml": "latest",
-    "json-schema-to-typescript": "^10.1.5",
+    "json-schema-to-typescript": "^11.0.2",
     "lint-staged": "latest",
     "lodash.camelcase": "^4.3.0",
     "lodash.set": "^4.3.2",
-    "node-fetch": "^3.2.6",
-    "prettier": "^2.6.2",
-    "typescript": "~4.7.3"
+    "node-fetch": "^3.2.10",
+    "prettier": "^2.7.1",
+    "typescript": "~4.7.4"
   },
   "lint-staged": {
     "*.{ts,tsx,js,jsx}": [
diff --git renovate.json renovate.json
index 4ad45928aa..4de1801c1a 100644
--- renovate.json
+++ renovate.json
@@ -39,9 +39,14 @@
       "groupName": "Jest packages"
     },
     {
-      "extends": ["packages:eslint"],
+      "matchPackagePatterns": ["eslint", "lint-staged"],
       "groupName": "ESLint packages"
     },
+    {
+      "matchPackagePatterns": ["@types"],
+      "matchUpdateTypes": ["patch", "minor"],
+      "groupName": "@types packages"
+    },
     {
       "matchPackagePrefixes": ["esbuild"],
       "groupName": "Esbuild packages"
diff --git src/constants.ts src/constants.ts
index b3,5e97f3b0..bbf6727984 100644
--- src/constants.ts
+++ src/constants.ts
@@ -1,10 +1,10 @@
 export const LINE_FEED = '\n'
 export const DECLARATION_TYPE_EXT = '.d.ts'
 export const JS_JSX_EXTENSIONS = ['.js', '.jsx']
-export const TS_TSX_REGEX = /\.tsx?$/
-export const JS_JSX_REGEX = /\.jsx?$/
-// `extensionsToTreatAsEsm` only accepts `.ts`, `.tsx` and `.jsx`. `.js`, `.cjs`, `.mjs` will throw error
-export const TS_EXT_TO_TREAT_AS_ESM = ['.ts', '.tsx']
+export const TS_TSX_REGEX = /\.m?tsx?$/
+export const JS_JSX_REGEX = /\.m?jsx?$/
+// `extensionsToTreatAsEsm` will throw error with `.mjs`
+export const TS_EXT_TO_TREAT_AS_ESM = ['.ts', '.tsx', '.mts']
 export const JS_EXT_TO_TREAT_AS_ESM = ['.jsx']
 /**
  * @internal
diff --git src/legacy/compiler/ts-compiler.ts src/legacy/compiler/ts-compiler.ts
index 9b7e3e82be..5ef5f3df8c 100644
--- src/legacy/compiler/ts-compiler.ts
+++ src/legacy/compiler/ts-compiler.ts
@@ -108,10 +108,11 @@ export class TsCompiler implements TsCompilerInstance {
         getCurrentDirectory: () => this.configSet.cwd,
         realpath: this._ts.sys.realpath && memoize(this._ts.sys.realpath),
         getDirectories: memoize(this._ts.sys.getDirectories),
+        useCaseSensitiveFileNames: () => this._ts.sys.useCaseSensitiveFileNames,
       }
       this._moduleResolutionCache = this._ts.createModuleResolutionCache(
         this.configSet.cwd,
-        (x) => x,
+        this._ts.sys.useCaseSensitiveFileNames ? (x) => x : (x) => x.toLowerCase(),
         this._compilerOptions,
       )
       this._createLanguageService()
@@ -285,6 +286,7 @@ export class TsCompiler implements TsCompilerInstance {
       .forEach((fileName) => this._fileVersionCache!.set(fileName, 0))
     /* istanbul ignore next */
     const serviceHost: LanguageServiceHost = {
+      useCaseSensitiveFileNames: () => this._ts.sys.useCaseSensitiveFileNames,
       getProjectVersion: () => String(this._projectVersion),
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       getScriptFileNames: () => [...this._fileVersionCache!.keys()],
@@ -346,7 +348,10 @@ export class TsCompiler implements TsCompilerInstance {
 
     this._logger.debug('created language service')
 
-    this._languageService = this._ts.createLanguageService(serviceHost, this._ts.createDocumentRegistry())
+    this._languageService = this._ts.createLanguageService(
+      serviceHost,
+      this._ts.createDocumentRegistry(this._ts.sys.useCaseSensitiveFileNames, this.configSet.cwd),
+    )
     this.program = this._languageService.getProgram()
   }
 
diff --git src/legacy/config/config-set.spec.ts src/legacy/config/config-set.spec.ts
index 9023b45a94..db99869cc5 100644
--- src/legacy/config/config-set.spec.ts
+++ src/legacy/config/config-set.spec.ts
@@ -539,6 +539,18 @@ describe('raiseDiagnostics', () => {
         ]
       `)
     })
+
+    it('should not throw when diagnostics is false', () => {
+      const cs = createConfigSet({
+        filterDiagnostics,
+        logger,
+        tsJestConfig: { diagnostics: false },
+      })
+
+      logger.target.clear()
+      expect(() => cs.raiseDiagnostics([])).not.toThrow()
+      expect(() => cs.raiseDiagnostics([makeDiagnostic()])).not.toThrow()
+    })
   })
 
   describe("diagnostics don't contain source file", () => {
diff --git src/legacy/config/config-set.ts src/legacy/config/config-set.ts
index cc2dd7026b..dd0df18168 100644
--- src/legacy/config/config-set.ts
+++ src/legacy/config/config-set.ts
@@ -295,9 +295,13 @@ export class ConfigSet {
         throws: diagnosticsOpt,
       }
     }
-    this._shouldIgnoreDiagnosticsForFile = this._diagnostics.exclude.length
-      ? globsToMatcher(this._diagnostics.exclude)
-      : () => false
+    if (diagnosticsOpt) {
+      this._shouldIgnoreDiagnosticsForFile = this._diagnostics.exclude.length
+        ? globsToMatcher(this._diagnostics.exclude)
+        : () => false
+    } else {
+      this._shouldIgnoreDiagnosticsForFile = () => true
+    }
 
     this.logger.debug({ diagnostics: this._diagnostics }, 'normalized diagnostics config via ts-,jest option')
 
diff --git src/legacy/ts-jest-transformer.spec.ts src/legacy/ts-jest-transformer.spec.ts
index 0ebe8d0b52..34cbdef4d1 100644
--- src/legacy/ts-jest-transformer.spec.ts
+++ src/legacy/ts-jest-transformer.spec.ts
@@ -376,7 +376,7 @@ describe('TsJestTransformer', () => {
       expect(process.env.TS_JEST).toBe('1')
     })
 
-    test.each(['foo.ts', 'foo.tsx'])('should process ts/tsx file', (filePath) => {
+    test.each(['foo.ts', 'foo.tsx', 'foo.mts', 'foo.mtsx'])('should process ts/tsx file', (filePath) => {
       const fileContent = 'const foo = 1'
       const output = 'var foo = 1'
       tr.getCacheKey(fileContent, filePath, baseTransformOptions)
@@ -391,30 +391,33 @@ describe('TsJestTransformer', () => {
       })
     })
 
-    test.each(['foo.js', 'foo.jsx'])('should process js/jsx file with allowJs true', (filePath) => {
-      const fileContent = 'const foo = 1'
-      const output = 'var foo = 1'
-      const transformOptions = {
-        ...baseTransformOptions,
-        config: {
-          ...baseTransformOptions.config,
-          globals: {
-            'ts-jest': { tsconfig: { allowJs: true } },
+    test.each(['foo.js', 'foo.jsx', 'foo.mjs', 'foo.mjsx'])(
+      'should process js/jsx file with allowJs true',
+      (filePath) => {
+        const fileContent = 'const foo = 1'
+        const output = 'var foo = 1'
+        const transformOptions = {
+          ...baseTransformOptions,
+          config: {
+            ...baseTransformOptions.config,
+            globals: {
+              'ts-jest': { tsconfig: { allowJs: true } },
+            },
           },
-        },
-      }
-      tr.getCacheKey(fileContent, filePath, transformOptions)
-      logTarget.clear()
-      jest.spyOn(TsJestCompiler.prototype, 'getCompiledOutput').mockReturnValueOnce({
-        code: output,
-      })
+        }
+        tr.getCacheKey(fileContent, filePath, transformOptions)
+        logTarget.clear()
+        jest.spyOn(TsJestCompiler.prototype, 'getCompiledOutput').mockReturnValueOnce({
+          code: output,
+        })
 
-      const result = tr.process(fileContent, filePath, transformOptions)
+        const result = tr.process(fileContent, filePath, transformOptions)
 
-      expect(result).toEqual({
-        code: output,
-      })
-    })
+        expect(result).toEqual({
+          code: output,
+        })
+      },
+    )
 
     test('should process file with unknown extension and show warning message without babel-jest', () => {
       const fileContent = 'foo'
diff --git src/presets/__snapshots__/create-jest-preset.spec.ts.snap src/presets/__snapshots__/create-jest-preset.spec.ts.snap
index 7d28dbdb8b..6ff107bf3f 100644
--- src/presets/__snapshots__/create-jest-preset.spec.ts.snap
+++ src/presets/__snapshots__/create-jest-preset.spec.ts.snap
@@ -61,6 +61,7 @@ Object {
     ".jsx",
     ".ts",
     ".tsx",
+    ".mts",
   ],
   "moduleFileExtensions": Array [
     "bar",
diff --git website/package.json website/package.json
index 053cb8e95f..6f60ab02ac 100644
--- website/package.json
+++ website/package.json
@@ -13,22 +13,22 @@
   },
   "dependencies": {
     "@akebifiky/remark-simple-plantuml": "^1.0.2",
-    "@docusaurus/core": "^2.0.0-beta.21",
-    "@docusaurus/plugin-ideal-image": "^2.0.0-beta.21",
-    "@docusaurus/plugin-pwa": "^2.0.0-beta.21",
-    "@docusaurus/preset-classic": "^2.0.0-beta.21",
+    "@docusaurus/core": "^2.0.1",
+    "@docusaurus/plugin-ideal-image": "^2.0.1",
+    "@docusaurus/plugin-pwa": "^2.0.1",
+    "@docusaurus/preset-classic": "^2.0.1",
     "@mdx-js/react": "^1.6.22",
-    "clsx": "^1.1.1",
-    "latest-version": "^6.0.0",
+    "clsx": "^1.2.1",
+    "latest-version": "^7.0.0",
     "react": "^16.14.0",
     "react-dom": "^16.14.0"
   },
   "devDependencies": {
-    "@babel/core": "^7.18.5",
-    "@docusaurus/module-type-aliases": "^2.0.0-beta.21",
+    "@babel/core": "^7.18.10",
+    "@docusaurus/module-type-aliases": "^2.0.1",
     "@tsconfig/docusaurus": "^1.0.6",
     "@types/react": "^16.14.24",
-    "typescript": "~4.7.3"
+    "typescript": "~4.7.4"
   },
   "browserslist": {
     "production": [
diff --git website/src/pages/versions.tsx website/src/pages/versions.tsx
index 116484b44c..f627253217 100644
--- website/src/pages/versions.tsx
+++ website/src/pages/versions.tsx
@@ -1,15 +1,24 @@
 import Link from '@docusaurus/Link'
-import { useVersions, useLatestVersion } from '@docusaurus/plugin-content-docs/client'
 import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
 import Layout from '@theme/Layout'
 import React from 'react'
 
+import versions from '../../versions.json'
+
 function Version() {
   const { siteConfig } = useDocusaurusContext()
-  const versions = useVersions()
-  const latestVersion = useLatestVersion()
-  const pastVersions = versions.filter((version) => version !== latestVersion && version.name !== 'current')
-  const nextVersion = versions[0]
+  const latestVersion = {
+    label: versions[0],
+    path: 'https://thymikee.github.io/jest-preset-angular/docs',
+  }
+  const pastVersions = versions.slice(1).map((version) => ({
+    label: version,
+    path: `https://thymikee.github.io/jest-preset-angular/docs/${version}`,
+  }))
+  const nextVersion = {
+    label: 'Next',
+    path: 'https://thymikee.github.io/jest-preset-angular/docs/next',
+  }
   const repoUrl = `https://github.com/${siteConfig.organizationName}/${siteConfig.projectName}`
 
   return (
@@ -55,14 +64,14 @@ function Version() {
           </table>
         </div>
 
-        {pastVersions.length > 0 && (
+        {pastVersions.length && (
           <div className="margin-bottom--lg">
             <h3 id="archive">Past versions (Not maintained anymore)</h3>
             <p>Here you can find documentation for previous versions of Docusaurus.</p>
             <table>
               <tbody>
                 {pastVersions.map((version) => (
-                  <tr key={version.name}>
+                  <tr key={version.label}>
                     <th>{version.label}</th>
                     <td>
                       <Link to={version.path}>Documentation</Link>
diff --git website/tsconfig.json website/tsconfig.json
index f0996d3e22..be3c830278 100644
--- website/tsconfig.json
+++ website/tsconfig.json
@@ -1,6 +1,7 @@
 {
   "extends": "@tsconfig/docusaurus/tsconfig.json",
   "compilerOptions": {
-    "skipLibCheck": true
+    "skipLibCheck": true,
+    "resolveJsonModule": true
   }
 }
diff --git website/versioned_docs/version-28.0/guides/esm-support.md website/versioned_docs/version-28.0/guides/esm-support.md
index 77785fd466..42dfe8e532 100644
--- website/versioned_docs/version-28.0/guides/esm-support.md
+++ website/versioned_docs/version-28.0/guides/esm-support.md
@@ -93,3 +93,22 @@ module.exports = {
   }
 }
 \`\`\`
+
+#### Support `.mts` extension
+
+To work with `.mts` extension, besides the requirement to run Jest and `ts-jest` in ESM mode, there are a few extra requirements to be met:
+
+- `package.json` should contain `"type": "module"`
+- A custom Jest resolver to resolve `.mjs` extension, see our simple one at https://github.com/kulshekhar/ts-jest/blob/main/e2e/native-esm-ts/mjs-resolver.ts
+- `tsconfig.json` should at least contain these following options
+
+```json
+{
+  "compilerOptions": {
+    "module": "Node16", // or "NodeNext"
+    "target": "ESNext",
+    "moduleResolution": "Node16", // or "NodeNext"
+    "esModuleInterop": true
+  }
+}
+```

Description

This PR updates various dependencies, improves ESM support, and refactors the CI workflow. It also includes several bug fixes and improvements to the codebase.

Changes

Changes

  1. .github/workflows/ci.yml:

    • Refactored the CI workflow to use reusable workflows
    • Updated Node.js versions and simplified the job structure
  2. .github/workflows/doc-generator.yml:

    • Updated the GitHub Pages deploy action version
  3. .github/workflows/prepare-cache.yml (new file):

    • Added a new reusable workflow for preparing npm cache
  4. .github/workflows/release-and-publish.yml:

    • Updated Node.js version and GitHub release action
  5. .github/workflows/test.yml (new file):

    • Added a new reusable workflow for running tests
  6. e2e/native-esm-ts/:

    • Added support for .mts files
    • Updated package.json and tsconfig.json for ESM support
  7. src/constants.ts:

    • Updated regex and file extensions to support .mts files
  8. src/legacy/compiler/ts-compiler.ts:

    • Added support for case-sensitive file names
  9. src/legacy/config/config-set.ts:

    • Improved handling of diagnostics configuration
  10. website/:

    • Updated dependencies and versioning logic
  11. Various other files:

    • Updated dependencies and versions
    • Made minor improvements and bug fixes
sequenceDiagram
    participant CI as CI Workflow
    participant Cache as Prepare Cache
    participant Lint as Lint Job
    participant Test as Test Job
    participant Finish as Finish Job

    CI->>Cache: Prepare npm cache
    Cache-->>CI: Cache ready
    CI->>Lint: Run linting
    CI->>Test: Run tests
    Test-->>CI: Tests complete
    CI->>Finish: Run Coveralls
    Finish-->>CI: CI complete
Loading

Security Hotspots

  • The PR updates several dependencies, which generally improves security. However, it's always good to review the changes in major version updates of dependencies.

@renovate renovate bot force-pushed the renovate/ts-jest-28.x branch from 7f149e2 to 7c713fe Compare December 19, 2024 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants