serverless-webpack icon indicating copy to clipboard operation
serverless-webpack copied to clipboard

fix: prevent duplicate artifact assignment (#1242)

Open NoxHarmonium opened this issue 3 years ago • 1 comments

What did you implement:

Prevent duplicate artifact assignment, extracted some duplicate logic.

Closes #1242

How did you implement it:

Some minor refactoring so that code paths are not called twice redundantly (see issue #1242)

Old Coverage:


=============================== Coverage summary ===============================
Statements   : 95.92% ( 2566/2675 )
Branches     : 89.67% ( 530/591 )
Functions    : 98.18% ( 108/110 )
Lines        : 95.92% ( 2566/2675 )
================================================================================

New Coverage:

=============================== Coverage summary ===============================
Statements   : 95.95% ( 2584/2693 )
Branches     : 89.71% ( 532/593 )
Functions    : 98.19% ( 109/111 )
Lines        : 95.95% ( 2584/2693 )
================================================================================

How can we verify it:

  1. Run sls package --verbose with individual packaging switched on.
  2. Grep for "Setting artifact for function"
  3. Check that each function is only mentioned once

I have tested this in my local project and it works for me.

Todos:

  • [X] Write tests
  • [X] Write documentation
  • [X] Fix linting errors
  • [X] Make sure code coverage hasn't dropped
  • [X] Provide verification config / commands / resources
  • [X] Enable "Allow edits from maintainers" for this PR
  • [X] Update the messages below

Is this ready for review?: YES Is it a breaking change?: NO

NoxHarmonium avatar Sep 20 '22 03:09 NoxHarmonium

Typo fixed and branch rebased!

NoxHarmonium avatar Sep 24 '22 01:09 NoxHarmonium