-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env", | ||
"@babel/preset-react" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,15 +24,10 @@ describe('AssetDropzone', () => { | |
let item = null; | ||
|
||
beforeEach(() => { | ||
item = ReactTestUtils.renderIntoDocument( | ||
<AssetDropzone {...props} /> | ||
); | ||
item = new AssetDropzone(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
}); | ||
|
||
it('should set this.dropzone to null', () => { | ||
item.dropzone = 1; | ||
item.constructor(props); | ||
|
||
expect(item.dropzone).toBe(null); | ||
}); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,8 @@ | |
], | ||
"transform": { | ||
".*": "babel-jest" | ||
} | ||
}, | ||
"testEnvironment": "jsdom" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is required for things like 'document' to be globally available |
||
}, | ||
"devDependencies": { | ||
"@silverstripe/eslint-config": "^1.0.0-alpha6", | ||
|
@@ -75,6 +76,7 @@ | |
"graphql-fragments": "^0.1.0", | ||
"graphql-tag": "^2.12.6", | ||
"griddle-react": "^0.8.2", | ||
"jest-environment-jsdom": "^29.3.1", | ||
"merge": "^2.1.1", | ||
"modernizr": "^3.12.0", | ||
"prop-types": "^15.8.1", | ||
|
@@ -99,11 +101,5 @@ | |
}, | ||
"browserslist": [ | ||
"defaults" | ||
], | ||
"babel": { | ||
"presets": [ | ||
"@babel/preset-env", | ||
"@babel/preset-react" | ||
] | ||
} | ||
] | ||
} |
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