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
[WIP] feat(textlint-tester): implement snapshot testing #548
Conversation
|
||
` | ||
|
||
exports['123_345 1'] = ` |
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 should define what snapshot output format.
- Input
- (Optional) Output
- (Optional) Lint Message for human
const inputPath = typeof state === "object" ? state.inputPath : undefined; | ||
const ext = typeof state === "object" && state.ext !== undefined ? state.ext : ".md"; | ||
const singleName = text.split(/\n/g).join("_"); | ||
it(text || inputPath || "NO name", () => { |
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.
TODO: should support inputPath
correctly
It will change rule test flow. Current:
Snapshot:
|
Anothor option: user can specify file name per test case. tester.run(rule, {
snapshots: {
"filename.txt": { text: "string" }
}
}); |
A workaround for bahmutov/snap-shot-core#117 But, it is not working all case
1e17185
to
0b54591
Compare
Blocker: bahmutov/snap-shot-core#195 |
I'll separate this snapshot testing as other testing library. Because, we need to try it and get error before merging snapshot testing. |
Close this. We will implement this based on secretlint |
POC: implement snapshot testing using snap-shot-core
It includes very hacky way for bahmutov/snap-shot-core#51
process.chdir
is bad...fix #542