mirror of
https://github.com/actions/setup-node
synced 2024-12-23 13:42:42 +00:00
aint pretty but it works
This commit is contained in:
parent
1e2990d3cd
commit
9ca6fa06b4
3 changed files with 14 additions and 6 deletions
|
@ -911,11 +911,20 @@ describe('setup-node', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('corepack', () => {
|
describe('corepack', () => {
|
||||||
it.only('supports pnpm automatically from Node v14+', async () => {
|
it('supports pnpm automatically from Node v14+', async () => {
|
||||||
inputs['node-version'] = '14.9.0';
|
inputs['node-version'] = '14.19.0';
|
||||||
inputs['cache'] = 'pnpm';
|
inputs['cache'] = 'pnpm';
|
||||||
|
|
||||||
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
|
|
||||||
|
isCacheActionAvailable.mockImplementation(() => true);
|
||||||
|
|
||||||
|
const toolPath = path.normalize('/cache/node/14.19.0/x64');
|
||||||
|
findSpy.mockReturnValue(toolPath);
|
||||||
|
|
||||||
await main.run();
|
await main.run();
|
||||||
expect(execSpy).toBeCalledWith('corepack enable');
|
|
||||||
|
expect(cnSpy).toHaveBeenNthCalledWith(2, `[command]${process.execPath.substring(0, process.execPath.length - 4)}corepack enable\n`);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
3
dist/setup/index.js
vendored
3
dist/setup/index.js
vendored
|
@ -6517,10 +6517,9 @@ function run() {
|
||||||
if (registryUrl) {
|
if (registryUrl) {
|
||||||
auth.configAuthentication(registryUrl, alwaysAuth);
|
auth.configAuthentication(registryUrl, alwaysAuth);
|
||||||
}
|
}
|
||||||
core.info('here');
|
|
||||||
if (cache && cache_utils_1.isCacheFeatureAvailable()) {
|
if (cache && cache_utils_1.isCacheFeatureAvailable()) {
|
||||||
if (semver_1.default.gte(version, '14.19.0')) {
|
|
||||||
core.info('here');
|
core.info('here');
|
||||||
|
if (semver_1.default.gte(version, '14.19.0')) {
|
||||||
try {
|
try {
|
||||||
core.info(yield cache_utils_1.getCommandOutput('corepack enable'));
|
core.info(yield cache_utils_1.getCommandOutput('corepack enable'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import * as path from 'path';
|
||||||
import {restoreCache} from './cache-restore';
|
import {restoreCache} from './cache-restore';
|
||||||
import {isGhes, isCacheFeatureAvailable, getCommandOutput} from './cache-utils';
|
import {isGhes, isCacheFeatureAvailable, getCommandOutput} from './cache-utils';
|
||||||
import os = require('os');
|
import os = require('os');
|
||||||
import semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue