os#arch JavaScript Examples

The following examples show how to use os#arch. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: installer.test.js    From setup-graalvm with MIT License 6 votes vote down vote up
describe('installer', () => {
    afterAll(async () => {
        await safeDelete(CACHE_DIR);
        await safeDelete(TEMP_DIR);
    });

    it('Installs GraalVM', async () => {
        const javaVersion    = 11;
        const graalvmVersion = '20.1.0';
        const options        = {
            tempDir  : TEMP_DIR,
            jvmDir   : join(TEMP_DIR, 'Library', 'Java', 'JavaVirtualMachines'),
            javaHome : 'TEST_JAVA_HOME',
        };

        const toolPath = await getGraalVM(javaVersion, graalvmVersion, options);

        if (process.platform === 'darwin') {
            expect(toolPath).toBe(join(CACHE_DIR, 'GraalVM', `java${javaVersion}-darwin-amd64-${graalvmVersion}`, arch()));
            expect(process.env[ options.javaHome ]).toBe(join(toolPath, '/Contents/Home'));
        } else if (process.platform === 'win32') {
            expect(toolPath).toBe(join(CACHE_DIR, 'GraalVM', `java${javaVersion}-windows-amd64-${graalvmVersion}`, arch()));
            expect(process.env[options.javaHome]).toBe(toolPath);
        } else if (process.arch === 'arm64') {
            expect(toolPath).toBe(join(CACHE_DIR, 'GraalVM', `java${javaVersion}-linux-aarch64-${graalvmVersion}`, arch()));
            expect(process.env[options.javaHome]).toBe(toolPath);
        } else {
            expect(toolPath).toBe(join(CACHE_DIR, 'GraalVM', `java${javaVersion}-linux-amd64-${graalvmVersion}`, arch()));
            expect(process.env[options.javaHome]).toBe(toolPath);
        }
    });
});