"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractCIProvider = exports.extractTestEnvironment = void 0;
const os = __importStar(require("os"));
function extractTestEnvironment(baseEnvironment) {
    return {
        ...baseEnvironment,
        versions: {
            ...baseEnvironment === null || baseEnvironment === void 0 ? void 0 : baseEnvironment.versions,
            core: require('../../package.json').version,
            node: process.version,
        },
        platform: `${os.type()}@${os.release()}`,
        arch: os.arch(),
        ram: os.totalmem(),
        ci: extractCIProvider(),
    };
}
exports.extractTestEnvironment = extractTestEnvironment;
function extractCIProvider() {
    if (process.env.TF_BUILD)
        return 'Azure';
    else if (process.env['bamboo.buildKey'])
        return 'Bamboo';
    else if (process.env.BUILDKITE)
        return 'Buildkite';
    else if (process.env.CIRCLECI)
        return 'Circle';
    else if (process.env.CIRRUS_CI)
        return 'Cirrus';
    else if (process.env.CODEBUILD_BUILD_ID)
        return 'CodeBuild';
    else if (process.env.GITHUB_ACTIONS)
        return 'GitHub Actions';
    else if (process.env.GITLAB_CI)
        return 'GitLab';
    else if (process.env.HEROKU_TEST_RUN_ID)
        return 'Heroku';
    else if (process.env.BUILD_ID)
        return 'Jenkins';
    else if (process.env.TEAMCITY_VERSION)
        return 'TeamCity';
    else if (process.env.TRAVIS)
        return 'Travis';
    return null;
}
exports.extractCIProvider = extractCIProvider;
