q.js
:-/src/q.js
function sum(a, b) {
return a + b;
}
module.exports = sum;
q.test.js
:-/tests/q.test.js
const sum = require('../src/q');
test('adds 1 + 2 to equal 3', () => {
const result = sum(1, 3);
expect(result).toBe(4);
});
即使给出错误,也完全从jest
文档中复制了此错误!
https://jestjs.io/docs/en/getting-started
错误屏幕截图: