Editing Shortcuts and Source Control
Explore how to streamline your React test-driven development using VS Code's editing shortcuts and integrated Git source control. Understand managing editor groups, running Jest tests in watch mode, and handling Git tasks directly within VS Code for a smoother development workflow.
We'll cover the following...
Using Editor Groups
Let’s get back into the rhythm of TDD. For our project, we’re going to write a function that finds all palindromes in a string. A palindrome is a phrase that’s spelled the same forwards and backwards (ignoring spaces and punctuation). For example:
palindromes('What number is never odd or even, asked the Sphinx?')
would return:
['neveroddoreven']
As frivolous as a program for finding palindromes may sound, it’s a good approximation of a real project in one important sense: the requirements aren’t precisely defined. Whereas Fizz Buzz had crystal-clear rules that we could translate directly into tests, figuring out a reasonable set of rules for the palindrome finder will require creativity and experimentation.
Create a “New Untitled File” (⌘ N on macOS, ^ N on Windows and Linux), then save it (⌘ S on macOS, ^ S on Windows and Linux) as palindromes.js. Repeat for palindromes.test.js.
Now let’s try viewing the two ...