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

feat: support ArrowFunctionExpression #98

Merged
merged 2 commits into from
Jan 14, 2024

Conversation

AriPerkkio
Copy link
Contributor

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Adds support for traversing ArrowFunctionExpressions. This is needed for vitest-dev/vitest#4695.

I've verified that with these changes following test will pass and covers my use case:

it("Vitest threshold updating", () => {
  const mod = parseModule(`
    import { defineConfig } from 'vitest/config'

    export default defineConfig((config) => ({
      test: {
        coverage: {
          thresholds: {
            autoUpdate: true,
            lines: 50,
            branches: 1,
          }
        }
      }
     }))
  `);

  mod.exports.default.$args[0].$body.test.coverage.thresholds.lines = 95;
  mod.exports.default.$args[0].$body.test.coverage.thresholds.branches = 100;

  expect(mod.generate().code).toMatchInlineSnapshot(`
      "import { defineConfig } from 'vitest/config'

      export default defineConfig((config) => ({
        test: {
          coverage: {
            thresholds: {
              autoUpdate: true,
              lines: 95,
              branches: 100,
            }
          }
        }
       }))"
    `);
});

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

codecov bot commented Jan 14, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (f9b707f) 93.53% compared to head (5e5a09f) 93.58%.

Files Patch % Lines
src/proxy/arrow-function-expression.ts 93.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #98      +/-   ##
==========================================
+ Coverage   93.53%   93.58%   +0.04%     
==========================================
  Files          23       24       +1     
  Lines        1749     1792      +43     
  Branches      328      331       +3     
==========================================
+ Hits         1636     1677      +41     
- Misses        113      115       +2     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@AriPerkkio
Copy link
Contributor Author

5e5a09f is related to esno's dependency on tsx and this error that comes up now with newer versions of Node: privatenumber/tsx#421

@antfu antfu merged commit fb9bace into unjs:main Jan 14, 2024
3 checks passed
@AriPerkkio AriPerkkio deleted the feat/support-arrow-function-expression branch January 14, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing castings
2 participants