Skip to content

test(js,ts): pin require().default and abstract classes to the declared default - #2481

Merged
colbymchenry merged 1 commit into
mainfrom
claude/optimistic-austin-1ba4ca
Oct 10, 2026
Merged

colbymchenry merged 1 commit into
mainfrom
claude/optimistic-austin-1ba4ca

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

What

Two regression cases for the default-export reading #2432 landed (33c1436), and one CHANGELOG sentence. No code change.

#2432 made a default import read the module's own export default statement instead of guessing the first exported function or class. Its merge also pointed #2433's require('./x').default fallback (esmDefaultExport) at the same reading. No test pinned that path with a guessable helper above the default, because #2433's fixture keeps its helper unexported.

  • require().default of React Native's AnimatedColor shape. The module exports a helper above export default class AnimatedColor (Libraries/Animated/nodes/AnimatedColor.js). It is loaded with require("./AnimatedColor").default and with const { default: Color } = require("./AnimatedColor"). With the first-exported guess, both new calls instantiate getRgbaValueAndNativeColor.
  • export default abstract class Repository below an exported connect(), extended by class Users extends Repository. With the guess, the extends edge is missing, because the guess returns a function.
  • CHANGELOG: the default-import bullet under [Unreleased] now says a module loaded with require('./x').default is read the same way.

Tests

Validation of the #2432 reading on react-native, topcoder and bitwarden

These are the repos where the helper-above-the-default shape was found (7 react-native files, 4 topcoder, 1 bitwarden), and #2432's own validation hadn't run on them.

How it was run:

repo edges re-resolved removed added
facebook/react-native 248,289 → 248,285 129 4 0
topcoder-platform/community-app 21,135 → 21,133 3 2 0
bitwarden/clients 298,434 → 298,448 0 0 14
controls: next-saas-starter, proshop_mern byte-identical
  • react-native. All 129 re-resolutions land on the declared default, or on a member of the default class:

    • flushValue → AnimatedValue ×92
    • isPlainObject → AnimatedObject.from ×18
    • getRgbaValueAndNativeColor → AnimatedColor ×12
    • rolePropSuite → accessibilityPropsSuite ×5
    • getOverrides → getFantomTestConfigs ×1
    • requireNativeComponent ×1. Base's default here was a component:RCTView node extracted from the doc-comment example requireNativeComponent('RCTView'), which export default requireNativeComponent; now beats.

    The 4 removed edges are function references to AnimatedValue and AnimatedColor, passed as values in AnimatedImplementation.js and AnimatedMock.js. They pointed at the helpers. The default is now the class, which a JS function reference doesn't target, so they are unresolved. Another 8 edges keep their target and move to import 0.9 (createAnimatedComponent, from exact-match 0.7 or function-ref 0.8).

  • topcoder.

    • DoSSR → SSR, and AppComponentSwitch → AppComponentLoader ×2.
    • Removed updateEntityData, which sits inside an anonymous export default ({ editor }) => ….
    • Removed isThriveLivePreview; the default is class ThriveArticleLivePreview.
  • bitwarden. export default abstract class AbstractChromeStorageService now gives:

    • 3 extends edges that failed before (BrowserLocalStorageService, BrowserMemoryStorageService, and the spec's TestChromeStorageApiService);
    • 3 interface-impl edges;
    • 8 calls through those classes (service.get ×5, this.localStorage.remove ×2, save ×1);
    • 3 instance-method calls that move from 0.65 to 0.9.

    Nothing was removed.

Overlap

🤖 Generated with Claude Code

…ed default

#2432 made a default import read the module's own `export default`
statement, and its merge pointed #2433's `require('./x').default`
fallback (esmDefaultExport) at the same reading. Nothing in the suite
pinned that path with a guessable helper above the default: #2433's
fixture keeps its helper unexported.

Two cases:
- React Native's AnimatedColor shape, an exported helper above
  `export default class AnimatedColor`, loaded with
  `require("./AnimatedColor").default` and
  `const { default: Color } = require("./AnimatedColor")`. With the
  first-exported guess both `new` calls instantiate the helper.
- `export default abstract class Repository` below an exported
  `connect()`, extended by `class Users extends Repository`. With the
  guess the `extends` edge is missing.

Both fail with e47cb25's resolver (before #2432). On main, putting the
guess back on the require path fails only the first, and dropping
`abstract` from the declaration pattern fails only the second.

The CHANGELOG's default-import bullet now says `require('./x').default`
is read the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant