-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MNT Fix js tests #1320
MNT Fix js tests #1320
Conversation
@@ -0,0 +1,6 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For non-admin modeles it seems that this config needs to be in babel.config.json rather than in package.json/.babelrc - https://babeljs.io/docs/en/configuration#whats-your-use-case
item = ReactTestUtils.renderIntoDocument( | ||
<AssetDropzone {...props} /> | ||
); | ||
item = new AssetDropzone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot no longer call constructor() directly on react components, need to use the new
keyword
@@ -44,7 +44,8 @@ | |||
], | |||
"transform": { | |||
".*": "babel-jest" | |||
} | |||
}, | |||
"testEnvironment": "jsdom" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required for things like 'document' to be globally available
43156b5
to
9d52f82
Compare
9d52f82
to
d832bac
Compare
Closed in favor of #1330 |
Issue silverstripe/silverstripe-admin#1421
This is far from complete, I got as far as getting the admin js to be transformed for jest. There's still a bunch of broken jest tests, most notably AssetAdmin-test.js and AssetAdminRouter-test.js