HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/f/r/e/frenchy/www/french-american.org/current/node_modules/snyk/dist/lib/snyk-test/index.js
"use strict";
module.exports = test;
const detect = require('../detect');
const runTest = require('./run-test');
const chalk = require('chalk');
const pm = require('../package-managers');
const { UnsupportedPackageManagerError } = require('../errors');
function test(root, options, callback) {
    if (typeof options === 'function') {
        callback = options;
        options = {};
    }
    if (!options) {
        options = {};
    }
    const promise = executeTest(root, options);
    if (callback) {
        promise
            .then((res) => {
            callback(null, res);
        })
            .catch(callback);
    }
    return promise;
}
function executeTest(root, options) {
    try {
        const packageManager = detect.detectPackageManager(root, options);
        options.packageManager = packageManager;
        return run(root, options).then((results) => {
            for (const res of results) {
                if (!res.packageManager) {
                    res.packageManager = packageManager;
                }
            }
            if (results.length === 1) {
                // Return only one result if only one found as this is the default usecase
                return results[0];
            }
            // For gradle and yarnWorkspaces we may be returning more than one result
            return results;
        });
    }
    catch (error) {
        return Promise.reject(chalk.red.bold(error));
    }
}
function run(root, options) {
    const packageManager = options.packageManager;
    if (!(options.docker || pm.SUPPORTED_PACKAGE_MANAGER_NAME[packageManager])) {
        throw new UnsupportedPackageManagerError(packageManager);
    }
    return runTest(packageManager, root, options);
}
//# sourceMappingURL=index.js.map