Skip to content

TS transforms not working when source file path contains some chars #56296

Closed
@aduh95

Description

@aduh95

Version

main

Platform

N/A

Subsystem

No response

What steps will reproduce the bug?

$ cat test/fixtures/test-runner/matching-patterns/typescript-test.cts                                            
const test = require('node:test');

// 'as string' ensures that type stripping actually occurs
test('this should pass' as string);
$ cp test/fixtures/test-runner/matching-patterns/typescript-test.cts dir%20with\ \$unusual\"chars\?\'åß∂ƒ©∆¬…\`.cts
$ ./node --experimental-transform-types dir%20with\ \$unusual\"chars\?\'åß∂ƒ©∆¬…\`.cts
node:internal/errors:540
      throw error;
      ^

TypeError [ERR_INVALID_ARG_TYPE]: The "payload" argument must be of type object. Received null
    at cloneSourceMapV3 (node:internal/source_map/source_map:365:3)
    at new SourceMap (node:internal/source_map/source_map:145:21)
    at findSourceMap (node:internal/source_map/source_map_cache:348:17)
    at lazyFindSourceMap (node:internal/test_runner/test:98:10)
    at new Test (node:internal/test_runner/test:556:21)
    at createTestTree (node:internal/test_runner/harness:82:16)
    at lazyBootstrapRoot (node:internal/test_runner/harness:264:5)
    at run (node:internal/test_runner/harness:302:61)
    at test (node:internal/test_runner/harness:317:12)
    at Object.<anonymous> (…/dir%20with $unusual"chars?'åß∂ƒ©∆¬…`.cts:3:1) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v24.0.0-pre

How often does it reproduce? Is there a required condition?

Required condition: source file path contains some special chars (not sure which)

What is the expected behavior? Why is that the expected behavior?

It should not throw

What do you see instead?

TypeError [ERR_INVALID_ARG_TYPE]: The "payload" argument must be of type object. Received null
    at cloneSourceMapV3 (node:internal/source_map/source_map:365:3)
    at new SourceMap (node:internal/source_map/source_map:145:21)
    at findSourceMap (node:internal/source_map/source_map_cache:348:17)
    at lazyFindSourceMap (node:internal/test_runner/test:98:10)
    at new Test (node:internal/test_runner/test:556:21)
    at createTestTree (node:internal/test_runner/harness:82:16)
    at lazyBootstrapRoot (node:internal/test_runner/harness:264:5)
    at run (node:internal/test_runner/harness:302:61)
    at test (node:internal/test_runner/harness:317:12)
    at Object.<anonymous> (…/dir%20with $unusual"chars?'åß∂ƒ©∆¬…`.cts:3:1) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    source mapsIssues and PRs related to source map support.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions