Fix tests and licences

This commit is contained in:
Salman Muin Kayser Chishti 2025-08-08 07:02:38 +01:00
commit e987e880f9
18 changed files with 49 additions and 103 deletions

View file

@ -6,8 +6,7 @@ import * as io from '@actions/io';
import * as toolchains from '../src/toolchains';
import {M2_DIR, MVN_TOOLCHAINS_FILE} from '../src/constants';
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-java-test-'));
const m2Dir = path.join(tempDir, M2_DIR);
const m2Dir = path.join(__dirname, M2_DIR);
const toolchainsFile = path.join(m2Dir, MVN_TOOLCHAINS_FILE);
describe('toolchains tests', () => {
@ -17,7 +16,7 @@ describe('toolchains tests', () => {
beforeEach(async () => {
await io.rmRF(m2Dir);
spyOSHomedir = jest.spyOn(os, 'homedir');
spyOSHomedir.mockReturnValue(tempDir);
spyOSHomedir.mockReturnValue(__dirname);
spyInfo = jest.spyOn(core, 'info');
spyInfo.mockImplementation(() => null);
}, 300000);
@ -25,7 +24,6 @@ describe('toolchains tests', () => {
afterAll(async () => {
try {
await io.rmRF(m2Dir);
await io.rmRF(tempDir);
} catch {
console.log('Failed to remove test directories');
}
@ -42,7 +40,7 @@ describe('toolchains tests', () => {
jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64'
};
const altHome = path.join(tempDir, 'runner', 'toolchains');
const altHome = path.join(__dirname, 'runner', 'toolchains');
const altToolchainsFile = path.join(altHome, MVN_TOOLCHAINS_FILE);
await io.rmRF(altHome); // ensure it doesn't already exist