forked from nodejs/corepack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: COREPACK_INTEGRITY_KEYS should support
0
and false
values t…
…o disable integrity checks (nodejs#468)
- Loading branch information
Showing
4 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { describe, it, expect } from "@jest/globals"; | ||
|
||
import { shouldSkipIntegrityCheck } from "../sources/corepackUtils"; | ||
|
||
describe(`corepack utils shouldSkipIntegrityCheck`, () => { | ||
it(`should return false if COREPACK_INTEGRITY_KEYS env is not set`, () => { | ||
delete process.env.COREPACK_INTEGRITY_KEYS; | ||
expect(shouldSkipIntegrityCheck()).toBe(false); | ||
}); | ||
|
||
it(`should return true if COREPACK_INTEGRITY_KEYS env is set to 0`, () => { | ||
process.env.COREPACK_INTEGRITY_KEYS = `0`; | ||
expect(shouldSkipIntegrityCheck()).toBe(true); | ||
}); | ||
|
||
it(`should return true if COREPACK_INTEGRITY_KEYS env is set to false`, () => { | ||
process.env.COREPACK_INTEGRITY_KEYS = `false`; | ||
expect(shouldSkipIntegrityCheck()).toBe(true); | ||
}); | ||
|
||
it(`should return true if COREPACK_INTEGRITY_KEYS env is set to FALSE`, () => { | ||
process.env.COREPACK_INTEGRITY_KEYS = `FALSE`; | ||
expect(shouldSkipIntegrityCheck()).toBe(true); | ||
}); | ||
|
||
it(`should return true if COREPACK_INTEGRITY_KEYS env is set to an empty string`, () => { | ||
process.env.COREPACK_INTEGRITY_KEYS = ``; | ||
expect(shouldSkipIntegrityCheck()).toBe(true); | ||
}); | ||
|
||
it(`should return true if COREPACK_INTEGRITY_KEYS env is set to a string with leading spaces`, () => { | ||
process.env.COREPACK_INTEGRITY_KEYS = ` false `; | ||
expect(shouldSkipIntegrityCheck()).toBe(true); | ||
}); | ||
|
||
it(`should return false if COREPACK_INTEGRITY_KEYS env is set to any other value`, () => { | ||
process.env.COREPACK_INTEGRITY_KEYS = JSON.stringify({ foo: `bar` }); | ||
expect(shouldSkipIntegrityCheck()).toBe(false); | ||
}); | ||
}); |