Uninote
Uninote
用户根目录
brdr
common
programming
docs
tests
后端试题
问题讨论

运行指定的单元测试

codex://threads/01a14d05-a2af-7d32-9402-b9c93f54fe55

在项目根目录运行。项目使用 Node.js 内置测试运行器:

# 运行指定测试文件(自动构建)
node scripts/run.mts node --test test/validation.test.js

# 只运行该文件中名称匹配的测试
node scripts/run.mts node --test --test-name-pattern="rejects unsupported" test/validation.test.js

# 运行多个指定文件
node scripts/run.mts node --test test/validation.test.js test/dom.test.js

# 运行全部单元测试
npm run test:unit

注意:参数使用编译后的扩展名:源码 .ts 对应 .js,.mts 对应 .mjs。例如:

node scripts/run.mts node --test test/outline.test.mjs

note

  • vm中单元测试需要管理员身份运行
  • 都没有增量编译,可以:
node scripts/run.mts --incremental node --test test/sync-local-rename.test.js

sync

AGENTS

点赞(0) 阅读(5) 举报
目录
标题