test: add benchmark

This commit is contained in:
harttle
2019-02-23 21:57:02 +08:00
parent 37d12a14eb
commit 279458c670
11 changed files with 150 additions and 7 deletions
-2
View File
@@ -14,7 +14,6 @@ export function mock (options: { [path: string]: (string | fileDescriptor) }) {
: val as fileDescriptor
})
fs.readFile = async function (path) {
console.log('mock fs read called', path)
const file = files[path]
if (file === undefined) throw new Error('ENOENT')
if (file.mode === '0000') throw new Error('EACCES')
@@ -22,7 +21,6 @@ export function mock (options: { [path: string]: (string | fileDescriptor) }) {
}
fs.exists = async function (path: string) {
console.log('mock fs exists called', path)
return !!files[path]
}
}
-3
View File
@@ -45,7 +45,6 @@ describe('error', function () {
it('should contain stack in err.stack', async function () {
const err = await expect(engine.parseAndRender('{% . a %}')).be.rejected
expect(err.message).to.contain('illegal tag syntax')
console.log(err.stack)
expect(err.stack).to.contain('at Liquid.parse')
})
describe('captureStackTrace compatibility', function () {
@@ -148,8 +147,6 @@ describe('error', function () {
'RenderError'
]
const err = await expect(engine.parseAndRender(html)).be.rejected
console.log(err.message)
console.log(err.stack)
expect(err.message).to.equal(`intended render error, file:${path.resolve('/throwing-tag.html')}, line:4, col:2`)
expect(err.stack).to.contain(message.join('\n'))
expect(err.name).to.equal('RenderError')