mirror of
https://github.com/actions/setup-dotnet.git
synced 2026-07-20 01:48:28 +00:00
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:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user