Skip to content

Commit

Permalink
Migrate to ESM (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
int128 authored Apr 28, 2024
1 parent 76359ba commit 0e9bfa3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
File renamed without changes.
12 changes: 7 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -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',
},
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"build": "ncc build --source-map --license licenses.txt src/main.ts",
"test": "jest"
},
"type": "module",
"dependencies": {
"@actions/core": "1.10.1",
"@actions/exec": "1.1.1"
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from '@actions/core'
import { run } from './run'
import { run } from './run.js'

const main = async (): Promise<void> => {
await run({
Expand Down
2 changes: 1 addition & 1 deletion tests/run.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { retry } from '../src/run'
import { retry } from '../src/run.js'

describe('retry', () => {
test('suceeded', async () => {
Expand Down
6 changes: 2 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
"outDir": "./lib"
}
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node20/tsconfig.json"
}

0 comments on commit 0e9bfa3

Please sign in to comment.