chai-inline-snapshot inline snapshot indent free auto insert npm install --dev chai npm install --dev chai-inline-snapshot import 'chai-inline-snapshot' import { expect } from 'chai' export let test = () => { let actual = [ { text: 'https://mp.weixin.qq.com/s/jLMBp1e7BC-PGr2tLEQpRQ\n周日读报', type: 'text' }, { index: 21, type: 'qqface' } ] expect(actual).to.matchInlineSnapshot(` [ { "text": "https://mp.weixin.qq.com/s/jLMBp1e7BC-PGr2tLEQpRQ 周日读报", "type": "text", }, { "index": 21, "type": "qqface", }, ] `) } ζ npm run coverage > c8 xv index.test.js indent.test.js ----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | index.js | 100 | 100 | 100 | 100 | ----------|---------|----------|---------|---------|-------------------