Sitelet https://github.com/actions/setup-node/pull/1495/commits/fc273c478a1cbf1960cfc5769476e0457328e2e1
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix security alerts
  • Loading branch information
gowridurgad
gowridurgad committed Feb 20, 2026
commit fc273c478a1cbf1960cfc5769476e0457328e2e1
10 changes: 8 additions & 2 deletions __tests__/cache-restore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import * as utils from '../src/cache-utils';
import {restoreCache} from '../src/cache-restore';

describe('cache-restore', () => {
process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data');
const setWorkspaceFor = (pm: 'npm' | 'yarn' | 'pnpm') => {
process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data', pm);
};
Comment thread
v-gowridurgad marked this conversation as resolved.
Outdated
if (!process.env.RUNNER_OS) {
process.env.RUNNER_OS = 'Linux';
}
Expand All @@ -25,7 +27,7 @@ describe('cache-restore', () => {
'abf7c9b306a3149dcfba4673e2362755503bcceaab46f0e4e6fee0ade493e20c';
const pnpmFileHash =
'26309058093e84713f38869c50cf1cee9b08155ede874ec1b44ce3fca8c68c70';
const cachesObject = {
const cachesObject: Record<string, string> = {
[npmCachePath]: npmFileHash,
[pnpmCachePath]: pnpmFileHash,
[yarn1CachePath]: yarnFileHash,
Expand Down Expand Up @@ -131,6 +133,8 @@ describe('cache-restore', () => {
])(
'restored dependencies for %s',
async (packageManager, toolVersion, fileHash) => {
// Set workspace to the appropriate fixture folder
setWorkspaceFor(packageManager as 'npm' | 'yarn' | 'pnpm');
Comment thread
v-gowridurgad marked this conversation as resolved.
Outdated
getCommandOutputSpy.mockImplementation((command: string) => {
if (command.includes('version')) {
return toolVersion;
Expand Down Expand Up @@ -161,6 +165,8 @@ describe('cache-restore', () => {
])(
'dependencies are changed %s',
async (packageManager, toolVersion, fileHash) => {
// Set workspace to the appropriate fixture folder
setWorkspaceFor(packageManager as 'npm' | 'yarn' | 'pnpm');
Comment thread
v-gowridurgad marked this conversation as resolved.
Outdated
getCommandOutputSpy.mockImplementation((command: string) => {
if (command.includes('version')) {
return toolVersion;
Expand Down
109 changes: 109 additions & 0 deletions __tests__/data/npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions __tests__/data/npm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "npm-fixture",
"engines": {
"node": "^24.0.0"
},
"dependencies": {
"accepts": "^1.3.8",
"array-flatten": "^3.0.0",
"bytes": "^3.1.2",
"content-disposition": "^0.5.4"
}
}
Loading