Cannot find module '@msinternal/ecs-flight' from 'node_modules/@microsoft/sp-core-library/lib-commonjs/SPFlight.js'
What causes it and how to fix it:
- In a Heft/SPFx project jest.mock() doesn't hoist — and sp-http drags in a missing MS-internal moduleTests run over pre-compiled lib-commonjs without Babel, so a mock written below the imports lands after require; write it above the imports or use moduleNameMapper (and why only some sp-http suites die on @msinternal/ecs-flight)Cause and fix →