Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

read properties of undefined #158

@tmkx

Description

@tmkx

jest --coverage output:

FAIL src/pages/pc/tests/app.node.spec.tsx
● Test suite failed to run

TypeError: .../player/dist/cjs/index.js: Cannot read properties of undefined (reading 'originalPositionFor')

  at SourceMapTree.originalPositionFor (../../node_modules/.pnpm/@[email protected]/node_modules/@ampproject/src/source-map-tree.ts:138:19)
  at trace (../../node_modules/.pnpm/@[email protected]/node_modules/@ampproject/src/source-map-tree.ts:70:25)
  at EncodedSourceMapImpl.map (../../node_modules/.pnpm/@[email protected]/node_modules/@jridgewell/src/encoded-map.ts:43:24)
  at TraceMap.map (../../node_modules/.pnpm/@[email protected]/node_modules/@jridgewell/src/trace-mapping.ts:85:23)
  at SourceMapTree.traceMappings (../../node_modules/.pnpm/@[email protected]/node_modules/@ampproject/src/source-map-tree.ts:42:26)
  at remapping (../../node_modules/.pnpm/@[email protected]/node_modules/@ampproject/src/remapping.ts:37:30)
  at mergeSourceMap (../../node_modules/.pnpm/@[email protected]/node_modules/@babel/core/lib/transformation/file/merge-map.js:19:30)
  at generateCode (../../node_modules/.pnpm/@[email protected]/node_modules/@babel/core/lib/transformation/file/generate.js:72:39)
  at run (../../node_modules/.pnpm/@[email protected]/node_modules/@babel/core/lib/transformation/index.js:55:33)
      at run.next (<anonymous>)

should ensure not nil before call the source.originalPositionFor?

const source = this.sources[segment[1]];
return source.originalPositionFor(
segment[2],
segment[3],
segment.length === 5 ? this.map.names[segment[4]] : name
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions