I need to setup jest and JavaScript Standard Style to work together when using npm test
.
Now when I am running npm test
the test fails because JavaScript Standard Style thrown an errors:
'test' is not defined.
'expect' is not defined.
I can work around this issue by defining in my package.json file some global for jest.
"standard": {
"globals": [
"fetch",
"test",
"expect"
]
}
But definitely I do not think it is a good solution.
In my test case sum.test.js
const sum = require('./sum')
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3)
})
In my package.json :
"scripts": {
"test": "standard && jest",
}
Question:
- How to configure JavaScript Standard Style so it does not thrown an error when used with jest?