avajs/ava

Support placeholder tokens in t.log()

开放

#1,654 创建于 2018年1月25日

 (2 条评论) (0 个反应) (0 位负责人)JavaScript (1,408 个派生)batch import
enhancementhelp wantedscope:test-interface

仓库指标

星标
 (20,600 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

t.log() is modeled after console.log(), which in Node.js uses util.format(). This function supports placeholder tokens. I couldn't quite find a maintained & ready module that would let us support the same tokens.

This is the behavior I'd expect:

Token Behavior
%s Cast the value to a string
%d Cast the value to a number
%i Parse the value as an integer
%f Parse the value as a float
%j Stringify the value as JSON, but output '[Circular]' if it contains circular references
%o Stringify using Concordance (current behavior since #1653)
%O Stringify using Concordance (current behavior since #1653)
%% Print '%'

贡献者指南