我在浏览器上收到“未定义测试” Uncaught ReferenceError。
我不使用ESLINT,根据this link,它是“未定义测试”的解决方案。 “ test”是在jest / expect测试库中全局设置的,预计在test.html中包含Expect.min.js文件之后才能使用。
In that case what could be the other reasons and their solution.
here is my code:
<script src="https://unpkg.com/expect@%3C21/umd/expect.min.js"></script>
<script src='script.js'></script>
<script>
test('myTest', () => {
a = {}
b = {}
a.rating = 1
b.rating = 2
expect(sortAlgo(a,b)).toBe(1)
})
</script>