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: update test for inline sourcemap #14597

Merged
merged 3 commits into from
Oct 14, 2023

Conversation

Dunqing
Copy link
Contributor

@Dunqing Dunqing commented Oct 12, 2023

Description

I noticed that the processing of #14370 is not related to the test.

According to the description of #14370's description, the inline-sourcemap should have been added in the transform, not hard code in the original file.

Also, this test blocked #14588

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.

@Dunqing Dunqing marked this pull request as ready for review October 12, 2023 10:18
@sapphi-red sapphi-red added p1-chore Doesn't change code behavior (priority) test labels Oct 12, 2023
sapphi-red
sapphi-red previously approved these changes Oct 12, 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.

Good catch! The sourcemap comment in the file will be stripped by

try {
map = (
convertSourceMap.fromSource(code) ||
(await convertSourceMap.fromMapFileSource(
code,
createConvertSourceMapReadMap(file),
))
)?.toObject()
code = code.replace(convertSourceMap.mapFileCommentRegex, blankReplacer)
} catch (e) {

So it wasn't going through the test we wanted to.

playground/js-sourcemap/foo-with-sourcemap.js Outdated Show resolved Hide resolved
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.

Thanks!

@sapphi-red sapphi-red merged commit 1243c2f into vitejs:main Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1-chore Doesn't change code behavior (priority) test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants