Fix "missing flag" error for non-boolean types (#18592)
Not all test flags are booleans, e.g. the build type
This commit is contained in:
parent
65237a237e
commit
0c3c27a718
|
@ -173,6 +173,13 @@ describe('transform test-gate-pragma: actual runtime', () => {
|
|||
}
|
||||
});
|
||||
|
||||
// @gate build === "development"
|
||||
test('strings', () => {
|
||||
if (!__DEV__) {
|
||||
throw Error("Doesn't work in production!");
|
||||
}
|
||||
});
|
||||
|
||||
// Always should fail because of the unguarded console.error
|
||||
// @gate false
|
||||
test('works with console.error tracking', () => {
|
||||
|
|
|
@ -58,7 +58,7 @@ function getTestFlags() {
|
|||
{
|
||||
get(flags, flagName) {
|
||||
const flagValue = flags[flagName];
|
||||
if (typeof flagValue !== 'boolean' && typeof flagName === 'string') {
|
||||
if (flagValue === undefined && typeof flagName === 'string') {
|
||||
throw Error(
|
||||
`Feature flag "${flagName}" does not exist. See TestFlags.js ` +
|
||||
'for more details.'
|
||||
|
|
Loading…
Reference in New Issue