Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aduh95 opened this issue Dec 17, 2024 · 2 comments · May be fixed by #56299
Open

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

aduh95 opened this issue Dec 17, 2024 · 2 comments · May be fixed by #56299
Labels
source maps Issues and PRs related to source map support. test_runner Issues and PRs related to the test runner subsystem.

Comments

@aduh95
Copy link
Contributor

aduh95 commented Dec 17, 2024

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

@marco-ippolito
Copy link
Member

Cc @legendecas

@legendecas legendecas added the source maps Issues and PRs related to source map support. label Dec 17, 2024
@legendecas legendecas linked a pull request Dec 17, 2024 that will close this issue
@legendecas
Copy link
Member

FWIW, this is not related to this forged path. This is due to the source map generated with --experimental-tranform-types is invalid, like //# sourceMappingURL=data:application/json;base64,-1. Anyway, this should not crash the test runner.

#56299 should fix this.

@legendecas legendecas added the test_runner Issues and PRs related to the test runner subsystem. label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source maps Issues and PRs related to source map support. test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants