Skip to content

Commit ba1ee87

Browse files
committed
Avoid JSON parsing
Cypress actually attempts to JSON parse strings itself, hence the test should still pass despite this change.
1 parent 74ce177 commit ba1ee87

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

lib/preprocessor-configuration.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,7 @@ function validateEnvironmentOverrides(
188188
if (hasOwnProperty(environment, "jsonArgs")) {
189189
let { jsonArgs } = environment;
190190
if (isString(jsonArgs)) {
191-
try {
192-
jsonArgs = JSON.parse(jsonArgs);
193-
} catch (err) {
194-
let parseErrorMessage = "";
195-
if (err instanceof Error) {
196-
parseErrorMessage = `JSON.parse(jsonArgs) failed with message:\n${err.message}`;
197-
}
198-
throw new Error(
199-
`Expected valid JSON (jsonArgs), but got ${util.inspect(
200-
jsonArgs
201-
)}\n${parseErrorMessage}`
202-
);
203-
}
191+
overrides.jsonArgs = [jsonArgs];
204192
}
205193
if (Array.isArray(jsonArgs) && jsonArgs.every(isString)) {
206194
overrides.jsonArgs = jsonArgs;

0 commit comments

Comments
 (0)