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

Add no rule metadata test case to sarif-test and fix that test failure. #27

Merged
merged 7 commits into from
May 11, 2021

Conversation

zhanwang626
Copy link
Contributor

@zhanwang626 zhanwang626 commented May 10, 2021

Summary

Add a no metadata rule test case that mentioned in Issue #26 and fix it.

Test

Npm test done.

 PASS  __tests__/sarif-test.js
  formatter:sarif
    when run
      ✓ should return a log with correct SARIF version and tool metadata (143 ms)
    when eslint version is known
      ✓ should return correct eslint version
    when passed no messages
      ✓ should return a log with files, but no results (1 ms)
    when passed one message
      ✓ should return a log with one file and one result (1 ms)
    when passed one message with a rule id
      ✓ should return a log with one rule (1 ms)
    when passed one message with line but no column nor source string
      ✓ should return a log with one result whose location region has only a startLine (4 ms)
    when passed one message with line and invalid column
      ✓ should return a log with one result whose location contains a region with line # and no column #
    when passed one message with line and column but no source string
      ✓ should return a log with one result whose location contains a region with line and column #s (1 ms)
    when passed one message with line, column, and source string
      ✓ should return a log with one result whose location contains a region with line and column #s
    when passed one message with a source string but without line and column #s
      ✓ should return a log with one result whose location contains a region with line and column #s (1 ms)
    when passed two results with two messages each
      ✓ should return a log with two files, three rules, and four results (3 ms)
    when passed two results with one having no message and one with two messages
      ✓ should return a log with two files, two rules, and two results (2 ms)
    when passed a result with no rule id
      ✓ should return a log with no rules, no results, and a tool execution notification (1 ms)
    when passed a rule with no description
      ✓ should return a log with one file, one rule, and one result (1 ms)
    when passed rules without metadata
      ✓ should return a log with one rule

Test Suites: 1 passed, 1 total
Tests:       15 passed, 15 total
Snapshots:   0 total
Time:        2.171 s
Ran all test suites.

@ghost
Copy link

ghost commented May 10, 2021

CLA assistant check
All CLA requirements met.

zhanwang626 and others added 2 commits May 10, 2021 09:44
Co-authored-by: Steve Calvert <steve.calvert@gmail.com>
Co-authored-by: Steve Calvert <steve.calvert@gmail.com>
@zhanwang626 zhanwang626 requested a review from scalvert May 10, 2021 16:44
packages/eslint-formatter-sarif/sarif.js Outdated Show resolved Hide resolved
packages/eslint-formatter-sarif/__tests__/sarif-test.js Outdated Show resolved Hide resolved
zhanwang626 and others added 2 commits May 10, 2021 14:23
Co-authored-by: Steve Calvert <steve.calvert@gmail.com>
@zhanwang626 zhanwang626 requested a review from scalvert May 10, 2021 21:26
Copy link
Collaborator

@scalvert scalvert left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@zhanwang626 zhanwang626 requested a review from scalvert May 11, 2021 15:34
@scalvert scalvert merged commit d8c7ff1 into microsoft:main May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants