"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const outdated_1 = require("@pnpm/outdated");
const path = require("path");
const test = require("tape");
process.chdir(path.join(__dirname, 'fixtures'));
const temp = path.join(__dirname, '..', '.tmp');
const outdatedOpts = {
    alwaysAuth: false,
    fetchRetries: 2,
    fetchRetryFactor: 10,
    fetchRetryMaxtimeout: 6e4,
    fetchRetryMintimeout: 1e4,
    networkConcurrency: 16,
    offline: false,
    rawNpmConfig: {},
    store: temp,
    strictSsl: true,
    tag: 'latest',
    userAgent: 'pnpm',
};
test('fail when there is no shrinkwrap.yaml file in the root of the project', (t) => __awaiter(this, void 0, void 0, function* () {
    try {
        yield outdated_1.default('no-shrinkwrap', outdatedOpts);
        t.fail('the call should have failed');
    }
    catch (err) {
        t.equal(err.message, 'No shrinkwrapfile in this directory. Run `pnpm install` to generate one.');
        t.end();
    }
}));
test('outdated()', (t) => __awaiter(this, void 0, void 0, function* () {
    const outdatedPkgs = yield outdated_1.default('wanted-shrinkwrap', outdatedOpts);
    t.deepEqual(outdatedPkgs, [
        {
            current: '1.0.0',
            latest: '2.1.0',
            packageName: 'is-negative',
            wanted: '1.1.0',
        },
        {
            current: '1.0.0',
            latest: '3.1.0',
            packageName: 'is-positive',
            wanted: '3.1.0',
        },
    ]);
    t.end();
}));
test('forPackages()', (t) => __awaiter(this, void 0, void 0, function* () {
    const outdatedPkgs = yield outdated_1.forPackages(['is-negative'], 'wanted-shrinkwrap', outdatedOpts);
    t.deepEqual(outdatedPkgs, [
        {
            current: '1.0.0',
            latest: '2.1.0',
            packageName: 'is-negative',
            wanted: '1.1.0',
        },
    ]);
    t.end();
}));
//# sourceMappingURL=index.js.map