Skip to content

Commit

Permalink
Use ESM (#758)
Browse files Browse the repository at this point in the history
* Use ESM

* Fix
  • Loading branch information
int128 authored Mar 27, 2024
1 parent 2b4224a commit 10d4e65
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
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"
},
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 { run } from '../src/run'
import { run } from '../src/run.js'

test('run successfully', async () => {
await expect(run({ name: 'foo' })).resolves.toBeUndefined()
Expand Down

0 comments on commit 10d4e65

Please sign in to comment.