Skip to content

Comments

feat: support ArrowFunctionExpression#98

Merged
antfu merged 2 commits intounjs:mainfrom
AriPerkkio:feat/support-arrow-function-expression
Jan 14, 2024
Merged

feat: support ArrowFunctionExpression#98
antfu merged 2 commits intounjs:mainfrom
AriPerkkio:feat/support-arrow-function-expression

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.

@codecov
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
@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