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
Add typescript/ts/tsx extension as a playground languages #1543
Conversation
Codecov Report
|
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.
Thanks for the pull request! I've left couple of minor comments, and we can release it with 11.0, which is kinda ready in a branch now.
`; | ||
|
||
const actual = chunkify(markdown); | ||
expect(actual).toMatchSnapshot(); |
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.
Let's avoid a snapshot here: it's hard to see if it's correct or not.
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.
so should I write the test something like this?
const expected = [
// expected result here
];
const actual = chunkify(markdown);
expect(actual).toEqual(expected);
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.
Here you can check all of the chunks, except the first one, have the code
type — that's the intent of the test. With a snapshot, it's impossible to tell what was the intent and whether it's correct.
Co-Authored-By: Artem Sapegin <artem@sapegin.ru>
@sapegin I updated my test code. please review me again. |
src/loaders/utils/__tests__/__snapshots__/chunkify.spec.ts.snap
Outdated
Show resolved
Hide resolved
@sapegin I updated my test code. please review me again. |
const actual = chunkify(markdown); | ||
expect(actual).toMatchSnapshot(); | ||
expect(actual).toEqual(expected); |
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.
Why not something like, so the test intent is actually clear?
expect(actual).toEqual(expected); | |
expect(actual.slice(1).every(chunk => chunk.type === 'code')).toBe(true) |
Not it's exactly the same as it was with a snapshot.
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 don't copy as is what the snapshot did. I thought the current tests also can test for not playground extensions.
but I would like to follow your suggestion.
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 didn't say you've copied but essentially it does the same.
@sapegin I updated my test code. please review me again. |
The idea is not to have a snapshot. Please have a look at my suggestion in my previous comment. |
I was misunderstood what you said. but now it is clear. thank you. @sapegin thank you for many times review. |
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.
Thanks!
Merged manually to 11 branch: 5975c7c |
Resolve:
tsx padded
Code example does not render when the code block hastsx padded
#1542I added
typescript
,ts
,tsx
as a playground language.It might make breaking current behavior.
it's up to you whichever it goes to the current version or next major version.