Skip to content
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

test: fix generate coverage report & test failure when not supported language with Prismjs #271

Merged
merged 2 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .nycrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://github.com/istanbuljs/nyc#common-configuration-options
all: true
Copy link
Member Author

@yoshinorin yoshinorin Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated coverage report file (lcov.info) is empty if we do not specify all : true.

4 changes: 2 additions & 2 deletions test/prism.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ describe('prismHighlight', () => {
'}'
].join('\n');

// Use language: 'plain' to simplify the test
const result = prismHighlight(input, { tab: ' ', lang: 'plain' });
// Use language: 'plain-text' for not supported language with Prism
const result = prismHighlight(input, { tab: ' ', lang: 'plain-text' });
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this test-case seems to test for not supported language with Prism. But, if we specify lang: 'plain the prismHighlight function will return Prism.highlight result.

So, we want to pass through return escapeHTML(code); in this test-case, but current test code pass through return Prism.highlight(code, Prism.languages[language], language);.

I think it happened before, not recently.


result.should.contains(escapeHTML(input.replace(/\t/g, ' ')));

Expand Down