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

docs(legacy): add test case to ensure correct csp hashes in readme.md #13384

Merged
merged 5 commits into from
Jun 1, 2023

Conversation

KAROTT7
Copy link
Contributor

@KAROTT7 KAROTT7 commented May 31, 2023

Description

fix #13373

updated CSP hashes in README.md and added a test case to ensure correct.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented May 31, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sapphi-red sapphi-red added documentation Improvements or additions to documentation plugin: legacy labels May 31, 2023
@sapphi-red sapphi-red changed the title fix(legacy): add test case to ensure correct csp hashes in readme.md docs(legacy): add test case to ensure correct csp hashes in readme.md May 31, 2023
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

Thank you!
Would you move the test in packages/legacy/__tests__ since this test doesn't require the browser?

@KAROTT7
Copy link
Contributor Author

KAROTT7 commented May 31, 2023

Okay, I will do it in tomorrow’s morning

Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

LGTM

misc changes I pushed
  • move the test case to a different file: this test is not related to snippets.ts
  • use encoding option of fs.readFileSync instead of Buffer::toString: maybe it's a preference but I think it's more clear
  • use expect(hashesInDoc).toStrictEqual(cspHashes) instead of expect(cspHashes.every).toBeTruthy(): this will give us a better failure message

@patak-dev patak-dev merged commit bf0cd25 into vitejs:main Jun 1, 2023
@KAROTT7 KAROTT7 deleted the fix-outdated-csp-hashes branch June 26, 2023 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation plugin: legacy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@vitejs/plugin-legacy CSP hashes outdated
3 participants