From 859bf2761595bba4a456b6d0189330a663e2864f Mon Sep 17 00:00:00 2001 From: mainframev Date: Tue, 15 Oct 2024 16:36:42 +0200 Subject: [PATCH] fixup! chore: update RuleTester config in tests --- tools/eslint-rules/rules/consistent-callback-type.spec.ts | 4 ++++ tools/eslint-rules/rules/no-missing-jsx-pragma.spec.ts | 4 ++++ tools/eslint-rules/rules/no-restricted-globals.spec.ts | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/tools/eslint-rules/rules/consistent-callback-type.spec.ts b/tools/eslint-rules/rules/consistent-callback-type.spec.ts index b3601fb2a7835b..9cea897a39ccbb 100644 --- a/tools/eslint-rules/rules/consistent-callback-type.spec.ts +++ b/tools/eslint-rules/rules/consistent-callback-type.spec.ts @@ -3,6 +3,10 @@ import { rule, RULE_NAME } from './consistent-callback-type'; const ruleTester = new RuleTester(); +global.structuredClone = jest.fn(val => { + return JSON.parse(JSON.stringify(val)); +}); + ruleTester.run(RULE_NAME, rule, { valid: [ // Valid when prop is TSTypeAliasDeclaration and the callback uses EventHandler diff --git a/tools/eslint-rules/rules/no-missing-jsx-pragma.spec.ts b/tools/eslint-rules/rules/no-missing-jsx-pragma.spec.ts index 5c2aa488910135..bbd72aa56423fc 100644 --- a/tools/eslint-rules/rules/no-missing-jsx-pragma.spec.ts +++ b/tools/eslint-rules/rules/no-missing-jsx-pragma.spec.ts @@ -5,6 +5,10 @@ const ruleTester = new RuleTester({ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }, }); +global.structuredClone = jest.fn(val => { + return JSON.parse(JSON.stringify(val)); +}); + ruleTester.run(RULE_NAME, rule, { valid: [ // no slot api used case diff --git a/tools/eslint-rules/rules/no-restricted-globals.spec.ts b/tools/eslint-rules/rules/no-restricted-globals.spec.ts index 7523db381e44cf..c2aade09c09c89 100644 --- a/tools/eslint-rules/rules/no-restricted-globals.spec.ts +++ b/tools/eslint-rules/rules/no-restricted-globals.spec.ts @@ -5,6 +5,10 @@ import { rule, RULE_NAME } from './no-restricted-globals'; const ruleTester = new RuleTester(); +global.structuredClone = jest.fn(val => { + return JSON.parse(JSON.stringify(val)); +}); + ruleTester.run(RULE_NAME, rule, { valid: [ {