From 6644fe9a6e17fbced0a58cb86ca7a06a18c61074 Mon Sep 17 00:00:00 2001 From: Deepak Prajapati Date: Mon, 6 Oct 2025 20:08:25 +0530 Subject: [PATCH] fix: revert test case to use import syntax like other system tests - Use ES6 import syntax instead of require for consistency - Follow the same pattern as externals-system test case - This should resolve the System is not defined error --- .../target/system-default-import-fix/index.js | 5 ++--- .../configCases/target/system-default-import-fix/test.js | 9 +++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/test/configCases/target/system-default-import-fix/index.js b/test/configCases/target/system-default-import-fix/index.js index 982ec9fbf..83e9d9f92 100644 --- a/test/configCases/target/system-default-import-fix/index.js +++ b/test/configCases/target/system-default-import-fix/index.js @@ -1,11 +1,10 @@ +import React, { useEffect } from "react"; + /* This test verifies that default imports work correctly with SystemJS externals * when the external module doesn't have a default property (e.g., React) */ it("should correctly handle default import from SystemJS external", function() { - const React = require("react"); - const { useEffect } = require("react"); - // React should be the entire module object, not undefined expect(React).toBeDefined(); expect(typeof React).toBe("object"); diff --git a/test/configCases/target/system-default-import-fix/test.js b/test/configCases/target/system-default-import-fix/test.js index dc2721be8..d01378be1 100644 --- a/test/configCases/target/system-default-import-fix/test.js +++ b/test/configCases/target/system-default-import-fix/test.js @@ -1,3 +1,6 @@ +import React, { useEffect } from "react"; +import ReactWithDefault, { useEffect as useEffectWithDefault } from "react-with-default"; + /* This test verifies that default imports work correctly with SystemJS externals * in both scenarios: * 1. External module without default property (traditional SystemJS) @@ -5,9 +8,6 @@ */ it("should correctly handle default import from SystemJS external without default property", function() { - const React = require("react"); - const { useEffect } = require("react"); - // React should be the entire module object, not undefined expect(React).toBeDefined(); expect(typeof React).toBe("object"); @@ -22,9 +22,6 @@ it("should correctly handle default import from SystemJS external without defaul }); it("should correctly handle default import from SystemJS external with default property", function() { - const ReactWithDefault = require("react-with-default"); - const { useEffect: useEffectWithDefault } = require("react-with-default"); - // ReactWithDefault should be the default property value expect(ReactWithDefault).toBeDefined(); expect(typeof ReactWithDefault).toBe("object");