@@ -2,20 +2,15 @@ import * as core from '@actions/core';
2
2
import * as cache from '@actions/cache' ;
3
3
import * as path from 'path' ;
4
4
import * as glob from '@actions/glob' ;
5
+ import osm from 'os' ;
5
6
6
7
import * as utils from '../src/cache-utils' ;
7
8
import { restoreCache } from '../src/cache-restore' ;
8
9
9
10
describe ( 'cache-restore' , ( ) => {
10
11
process . env [ 'GITHUB_WORKSPACE' ] = path . join ( __dirname , 'data' ) ;
11
- if ( ! process . env . RUNNER_OS ) {
12
- process . env . RUNNER_OS = 'Linux' ;
13
- }
14
- if ( ! process . env . RUNNER_ARCH ) {
15
- process . env . RUNNER_ARCH = 'X64' ;
16
- }
17
- const platform = process . env . RUNNER_OS ;
18
- const arch = process . env . RUNNER_ARCH ;
12
+ const platform = 'Linux' ;
13
+ const arch = 'arm64' ;
19
14
const commonPath = '/some/random/path' ;
20
15
const npmCachePath = `${ commonPath } /npm` ;
21
16
const pnpmCachePath = `${ commonPath } /pnpm` ;
@@ -56,6 +51,8 @@ describe('cache-restore', () => {
56
51
let getCommandOutputSpy : jest . SpyInstance ;
57
52
let restoreCacheSpy : jest . SpyInstance ;
58
53
let hashFilesSpy : jest . SpyInstance ;
54
+ let archSpy : jest . SpyInstance ;
55
+ let platformSpy : jest . SpyInstance ;
59
56
60
57
beforeEach ( ( ) => {
61
58
// core
@@ -106,6 +103,13 @@ describe('cache-restore', () => {
106
103
107
104
// cache-utils
108
105
getCommandOutputSpy = jest . spyOn ( utils , 'getCommandOutput' ) ;
106
+
107
+ // os
108
+ archSpy = jest . spyOn ( osm , 'arch' ) ;
109
+ archSpy . mockImplementation ( ( ) => arch ) ;
110
+
111
+ platformSpy = jest . spyOn ( osm , 'platform' ) ;
112
+ platformSpy . mockImplementation ( ( ) => platform ) ;
109
113
} ) ;
110
114
111
115
describe ( 'Validate provided package manager' , ( ) => {
0 commit comments