question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests: Refactor lib/plugins/aws/package/compile/functions/index.test.js

See original GitHub issue

Most of the tests that currently cover core functionalities depend heavily on (and sometimes test) internal implementation characteristics. While they should be testing whether given implementation produces desired outcome (treating its implementation more as a black box).

Current state of things is problematic for eventual internal improvements and refactors which occasionally we want to introduce, as in most of such cases proposed improvements need to be accompanied with counterproductive numerous updates to tests which are covering otherwise not altered functionalities .

_At some point we’ve introduced a new (black box based) way of testing the internals. It’s through runServerless utlity, which allows us create natural (as in real world) serverless instance, and inspect the produced outcome for chosen command. More details here: https://github.com/serverless/serverless/tree/master/test#unit-tests_


This is issue is about refactoring lib/plugins/aws/package/compile/functions/index.test.js to runServerless based variant.

It’s needed, so we cleanly move forward with https://github.com/serverless/serverless/issues/8396

To make refactor relatively easy:

For every refactored test, the old test should be removed

As this test file is large, let’s divide work into following parts (best if each part is addressed with individual PR):

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
sdas13commented, Jan 20, 2022

Thanks @pgrzesik I will keep an eye on the v3 release

1reaction
pgrzesikcommented, Nov 2, 2021

Thanks for being vigilant and letting me know about it @issea1015 🙇

Read more comments on GitHub >

github_iconTop Results From Across the Web

Red, Green, Refactor | Codecademy
Red, Green, Refactor ... Test-driven development (TDD) is an approach to software development where you write tests first, then use those tests to...
Read more >
3 Test Driven Development & Refactoring - YouTube
In this video, I start a new mini-series on testing basics with JavaScript & Jest. In this series, we'll cover the skills needed...
Read more >
Functional Test Refactoring: Introduction | by Zhimin Zhan
As you can see, Functional Testing Refactoring has been proved by some of the best ... Below are two test scripts in Mocha...
Read more >
Test-Driven Development Tutorial - freeCodeCamp
Refactor your program (if necessary). Continue the cycle until the calculator matches your vision. Let's now see a JavaScript example of a TDD ......
Read more >
3 Easy Steps to Refactoring Tests for Greater Clarity
Looking for ways to make my life better, I learned about Extreme Programming, including unit testing, test-driven development (TDD), and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found