diff --git a/package.json b/package.json index fe4762719..f1f5ef087 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "private": true, "name": "monorepo-deploy-actions", "license": "MIT", + "type": "module", "devDependencies": { "@eslint/js": "9.15.0", "@tsconfig/recommended": "1.0.8", diff --git a/update-outdated-pull-request-branch/jest.config.js b/update-outdated-pull-request-branch/jest.config.js index 4f97e5f78..f6a60fb23 100644 --- a/update-outdated-pull-request-branch/jest.config.js +++ b/update-outdated-pull-request-branch/jest.config.js @@ -1,7 +1,9 @@ -module.exports = { - preset: 'ts-jest', +/** @type {import('ts-jest').JestConfigWithTsJest} */ +export default { + preset: 'ts-jest/presets/default-esm', clearMocks: true, - testEnvironment: 'node', - testMatch: ['**/*.test.ts'], - verbose: true, + // https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/ + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.js$': '$1', + }, } diff --git a/update-outdated-pull-request-branch/package.json b/update-outdated-pull-request-branch/package.json index dc7ba5a10..739f1e8df 100644 --- a/update-outdated-pull-request-branch/package.json +++ b/update-outdated-pull-request-branch/package.json @@ -2,6 +2,7 @@ "name": "update-outdated-pull-request-branch", "version": "0.0.0", "private": true, + "type": "module", "scripts": { "build": "ncc build --source-map --license licenses.txt src/main.ts", "test": "jest" diff --git a/update-outdated-pull-request-branch/src/main.ts b/update-outdated-pull-request-branch/src/main.ts index 97bf052a1..66182852e 100644 --- a/update-outdated-pull-request-branch/src/main.ts +++ b/update-outdated-pull-request-branch/src/main.ts @@ -1,6 +1,6 @@ import * as core from '@actions/core' import * as github from '@actions/github' -import { run } from './run' +import { run } from './run.js' import assert from 'assert' const main = async (): Promise => { diff --git a/update-outdated-pull-request-branch/tests/run.test.ts b/update-outdated-pull-request-branch/tests/run.test.ts index bf952f752..362366bb0 100644 --- a/update-outdated-pull-request-branch/tests/run.test.ts +++ b/update-outdated-pull-request-branch/tests/run.test.ts @@ -1,4 +1,4 @@ -import { isExpired } from '../src/run' +import { isExpired } from '../src/run.js' describe('isExpired', () => { const now = () => Date.parse('2021-02-03T04:05:06Z')