So I'm trying to run jest for the first time in my project and I'm running into some confusing error.
I get path/config/polyfills.js: Property object of MemberExpression expected node to be of a type ["Expression"] but instead got null
when I run npm test
and my script looks like this: "test": "jest"
.
Here is also my polyfills.js
:
'use strict';
if (typeof Promise === 'undefined') {
// Rejection tracking prevents a common issue where React gets into an
// inconsistent state due to an error, but it gets swallowed by a Promise,
// and the user has no idea what causes React's erratic future behavior.
require('promise/lib/rejection-tracking').enable();
window.Promise = require('promise/lib/es6-extensions.js');
}
// fetch() polyfill for making API calls.
require('whatwg-fetch');
// Object.assign() is commonly used with React.
// It will use the native implementation if it's present and isn't buggy.
Object.assign = require('object-assign');
// In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
// We don't polyfill it in the browser--this is user's responsibility.
if (process.env.NODE_ENV === 'test') {
require('raf').polyfill(global);
}
This is my first time using jest and I didn't use create-react-app
to set up my application so a lot of the jest guides I've been looking at haven't been very helpful. Thanks for your help in advance!
Aucun commentaire:
Enregistrer un commentaire