-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
describeWithDOM enhancement #126
describeWithDOM enhancement #126
Conversation
mount, | ||
} from '../'; | ||
import { | ||
describeWithDOM, |
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.
s/\t/ /g
please
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.
woops, thought I caught those, will update
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.
@ljharb eslint should fail on these, right?
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.
theoretically, but i haven't gotten around to these rules yet, so i don't know how they're configured :-)
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 actually why I thought I got them all, the linter wasn't yelling at me anymore, so it doesn't appear to be catching them everywhere, because I was getting warnings in other places
Other than my comments, this looks awesome. |
7845c6b
to
975160a
Compare
This LGTM! It'd be a semver-minor. |
} | ||
|
||
describeWithDOM.only = only; | ||
describeWithDOM.skip = skip; |
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.
in order to eliminate duplication, you could do smth like: (pseudo code)
function testSuite(register, title, fn) {
describe('(uses jsdom)', () => {
if (typeof jsdom === 'function') {
jsdom();
register(a, b);
} else {
// if jsdom isn't available, skip every test in this describe context
describe.skip(a, b);
}
});
}
function only(title, fn) {
testSuite(describe.only, title, fn);
}
function skip(title, fn) {
testSuite(describe.skip, title, fn);
}
function describeWithDOM(title, fn) {
testSuite(describe, title, fn);
}
As I stated in different PRs, I think we should take care of other mocha interfaces as well (out of scope for this pr obviously), but @nfpiche might be interested in exploring |
For context, That said, I'm fine with merging this in for 1.x releases |
"test:all": "npm run react:13 && npm test && npm run react:14 && npm test", | ||
"test:describeWithDOMOnly": "mocha --compilers js:babel/register --recursive src/**/__tests__/describeWithDOM/describeWithDOMOnly-spec.js", | ||
"test:describeWithDOMSkip": "mocha --compilers js:babel/register --recursive src/**/__tests__/describeWithDOM/describeWithDOMSkip-spec.js", | ||
"test:all": "npm run react:13 && npm test && npm run test:describeWithDOMOnly && npm run test:describeWithDOMSkip && npm run react:14 && npm test && npm run test:describeWithDOMOnly && npm run test:describeWithDOMSkip", |
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.
i'm confused. Why exactly were these tests needed to be added separately?
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.
We didn't technically need it for .skip, but I felt like having it be consistent would be the way to go. We do need a separate run for the .only tests though, otherwise it will skip the rest of the test suite. Happy to change things up a bit to be less verbose if you have an idea though.
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.
I suppose that's fine. I'm not 100% sure we even need to add tests for describeWithDOM, but since they're already added it's better than nothing.
describeWithDOM enhancement
Let me know how this looks, wasn't 100% sure on taking describeWithDOM out of index.js