mirror of https://github.com/webpack/webpack.git
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
This commit is contained in:
parent
20dc109ec2
commit
6644fe9a6e
|
@ -1,11 +1,10 @@
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
|
||||||
/* This test verifies that default imports work correctly with SystemJS externals
|
/* This test verifies that default imports work correctly with SystemJS externals
|
||||||
* when the external module doesn't have a default property (e.g., React)
|
* when the external module doesn't have a default property (e.g., React)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
it("should correctly handle default import from SystemJS external", function() {
|
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
|
// React should be the entire module object, not undefined
|
||||||
expect(React).toBeDefined();
|
expect(React).toBeDefined();
|
||||||
expect(typeof React).toBe("object");
|
expect(typeof React).toBe("object");
|
||||||
|
|
|
@ -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
|
/* This test verifies that default imports work correctly with SystemJS externals
|
||||||
* in both scenarios:
|
* in both scenarios:
|
||||||
* 1. External module without default property (traditional SystemJS)
|
* 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() {
|
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
|
// React should be the entire module object, not undefined
|
||||||
expect(React).toBeDefined();
|
expect(React).toBeDefined();
|
||||||
expect(typeof React).toBe("object");
|
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() {
|
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
|
// ReactWithDefault should be the default property value
|
||||||
expect(ReactWithDefault).toBeDefined();
|
expect(ReactWithDefault).toBeDefined();
|
||||||
expect(typeof ReactWithDefault).toBe("object");
|
expect(typeof ReactWithDefault).toBe("object");
|
||||||
|
|
Loading…
Reference in New Issue