npm info it worked if it ends with ok
npm info using npm@3.10.10
npm info using node@v6.9.5
npm info lifecycle js-quiz@1.0.0~pretest: js-quiz@1.0.0
npm info lifecycle js-quiz@1.0.0~test: js-quiz@1.0.0
> js-quiz@1.0.0 test /var
> jasmine
Started
Failures:
1) count-string-in-collection 计数数组字符串
Message:
Expected undefined to equal [ 'a-2', 'b-2', 'c-1', 'd-1' ].
Stack:
Error: Expected undefined to equal [ 'a-2', 'b-2', 'c-1', 'd-1' ].
at Object.<anonymous> (/var/spec/count-string-spec.js:9:20)
1 spec, 1 failure
Finished in 0.013 seconds
npm info lifecycle js-quiz@1.0.0~test: Failed to exec test script
npm ERR! Test failed. See above for more details.
尝试过的方法:
我本以为是后台存数据库的时候就把 '\n' 丢掉了,然后我就在后台这样
JSON.stringfy(result)
,然后在前端这样JSON.parse
,然而并没有是么卵用。
尝试让结果输出成 markdown 格式,但发现 markdown 也识别不了 '\n' 。
根本原因是 html 识别不了 '\n',于是 google 了一下,发现只要一行代码就可以达到这种效果了: