Migrate to ESM and upgrade dependencies (#752)

* Migrate to ESM and upgrade dependencies

* Address review: use type-only import for QualityOptions

* update version to 6.0.0 in package.json and package-lock.json

* Add ESM migration note to README for V6

* Update test imports for ESM and clean up devDependencies (ts-node, @types/jest)

* Pin @types/node to 24.x and refine tsconfig/README wording
This commit is contained in:
Priya Gupta
2026-07-16 02:11:57 +05:30
committed by GitHub
parent 26b0ec14cb
commit 6df8cefd14
78 changed files with 117103 additions and 102620 deletions

View File

@@ -1,14 +1,32 @@
import * as cache from '@actions/cache';
import * as core from '@actions/core';
import fs from 'node:fs';
import {run} from '../src/cache-save';
import {getNuGetFolderPath} from '../src/cache-utils';
import {State} from '../src/constants';
import {beforeAll, beforeEach, describe, expect, it, jest} from '@jest/globals';
jest.mock('@actions/cache');
jest.mock('@actions/core');
jest.mock('node:fs');
jest.mock('../src/cache-utils');
jest.unstable_mockModule('@actions/cache', () => ({
saveCache: jest.fn()
}));
jest.unstable_mockModule('@actions/core', () => ({
setFailed: jest.fn(),
getState: jest.fn(),
setOutput: jest.fn(),
getBooleanInput: jest.fn(),
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn()
}));
jest.unstable_mockModule('node:fs', () => ({
default: {
existsSync: jest.fn()
}
}));
jest.unstable_mockModule('../src/cache-utils', () => ({
getNuGetFolderPath: jest.fn()
}));
const cache = await import('@actions/cache');
const core = await import('@actions/core');
const fs = (await import('node:fs')).default;
const {run} = await import('../src/cache-save.js');
const {getNuGetFolderPath} = await import('../src/cache-utils.js');
const {State} = await import('../src/constants.js');
describe('cache-save tests', () => {
beforeAll(() => {