Explicitly import crypto (#1842)

* Explicitly import `crypto`

* Add release notes for 1.11.1

* Fix crypto mock in test

* Fix `crypto` mock

* Lint
This commit is contained in:
Josh Gross
2024-10-04 17:23:42 -04:00
committed by GitHub
parent 22a72ac3d7
commit d14afd7973
7 changed files with 22 additions and 15 deletions

View File

@@ -46,6 +46,11 @@ const testEnvVars = {
const UUID = '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
const DELIMITER = `ghadelimiter_${UUID}`
jest.mock('crypto', () => ({
...jest.requireActual('crypto'),
randomUUID: jest.fn(() => UUID)
}))
const TEMP_DIR = path.join(__dirname, '_temp')
describe('@actions/core', () => {
@@ -66,10 +71,6 @@ describe('@actions/core', () => {
process.env[key] = testEnvVars[key as keyof typeof testEnvVars]
}
process.stdout.write = jest.fn()
jest.spyOn(crypto, 'randomUUID').mockImplementation(() => {
return UUID
})
})
afterEach(() => {