fix: prevent duplicate artifact assignment by NoxHarmonium · Pull Request #1245 · serverless-heaven/serverless-webpack (original) (raw)

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:

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