test-snapshot-typescript should work with typescript 6

未关闭 适合新手
#63,427 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
领域
testing-qa

调研方向

从 test/fixtures/snapshot/typescript-main.js 和 test/fixtures/snapshot/typescript.js 开始,然后使用 issue 中描述的 TypeScript 6 bundle 或 Debian package 文件运行 snapshot 测试。检查编译器选项和预期的 snapshot 输出;在 TypeScript 6 下测试完成且没有出现 AssertionError 即表示完成。

由索引模型根据 Issue 内容生成。

描述

Version

24.15.0

Platform
Linux lal 7.0.7+deb14-amd64 #1 SMP PREEMPT_DYNAMIC Debian 7.0.7-1 (2026-05-15) x86_64 GNU/Linux
Subsystem

test

What steps will reproduce the bug?

Replace test/fixtures/snapshot/typescript.js by typescript 6 bundle.

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

As a distributor, we avoid bundled software when not strictly necessary.
test/fixtures/snapshot/typescript.js
is such a thing. Instead, I use a copy of the node-typescript debian package files, setup before the tests.

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

No test error.

What do you see instead?

105s AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
105s + actual - expected
105s
105s + '"use strict";\n' +
105s + 'class VirtualPoint {\n' +
105s + ' x;\n' +
105s + ' y;\n' +
105s + ' constructor(x, y) {\n' +
105s - 'var VirtualPoint = /** @class */ (function () {\n' +
105s - ' function VirtualPoint(x, y) {\n' +
105s ' this.x = x;\n' +
105s ' this.y = y;\n' +
105s ' }\n' +
105s + '}\n' +
105s + 'const newVPoint = new VirtualPoint(13, 56);\n'
105s - ' return VirtualPoint;\n' +
105s - '}());\n' +
105s - 'var newVPoint = new VirtualPoint(13, 56);\n'

Additional information

Something like this could help

--- a/test/fixtures/snapshot/typescript-main.js
+++ b/test/fixtures/snapshot/typescript-main.js
@@ -20,7 +20,10 @@
     source,
     {
       compilerOptions: {
-        module: ts.ModuleKind.CommonJS
+        module: ts.ModuleKind.CommonJS,
+        strict: false,
+        alwaysStrict: false,
+        target: 'es5'
       }
     });
主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
273

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nodejs/node 的其他 Issue

查看 nodejs/node 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。