setup-graalvm/__tests__/msvc.test.ts

26 lines
946 B
TypeScript
Raw Permalink Normal View History

2024-03-12 12:30:08 +01:00
import * as path from 'path'
2025-02-10 09:16:33 +01:00
import { expect, test } from '@jest/globals'
import { needsWindowsEnvironmentSetup } from '../src/msvc'
import { VERSION_DEV, VERSION_LATEST } from '../src/constants'
2024-03-12 12:30:08 +01:00
process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')
test('decide whether Window env must be set up for GraalVM for JDK', async () => {
2025-02-10 09:16:33 +01:00
for (const javaVersion of ['17', '17.0.8', '17.0', '21', '22', '22-ea', '23-ea', VERSION_DEV]) {
2024-03-12 12:30:08 +01:00
expect(needsWindowsEnvironmentSetup(javaVersion, '', true)).toBe(false)
}
})
test('decide whether Window env must be set up for legacy GraalVM', async () => {
2025-01-21 13:03:20 +01:00
for (const combination of [
2024-03-12 12:30:08 +01:00
['7', '22.3.0'],
['17', '22.3'],
['7', '22.3'],
['7', VERSION_DEV],
['17', VERSION_LATEST]
]) {
2025-02-10 09:16:33 +01:00
expect(needsWindowsEnvironmentSetup(combination[0], combination[1], false)).toBe(combination[1] !== VERSION_DEV)
2024-03-12 12:30:08 +01:00
}
})