Colocating tests is putting your test next to its file.
Why colocate tests? Because colocating provides:
Example of a directory structure containing colocated tests:
.
└── src
├── file.js
└── file.test.js
Example of a directory structure containing non-colocated tests:
.
├── src
│ └── file.js
└── test
└── file.test.js
Colocated tests simplifies import paths:
// src/file.test.js
const file = require('./file');
Compared to non-colocation:
// test/file.test.js
const file = require('../test/file');
For small projects, non-colocation is manageable. But for larger projects, the import paths can get unwieldly:
const file = require('../../../test/dir/subdir/file');
For colocated tests…
Why use Context to handle React state? The same reason you use Redux to manage your application store. If your components talk to one another and lifting state becomes cumbersome, then Context is a native way to deal with your application state.
We will be refactoring <App>
—which uses local state—to use Context:
As you can see, there’s a counter with 2 buttons that increments or decrements the count.
Create <Provider>
and set prop value
to 0:
Render <Provider>
as the top-level component in index.js
:
Get the Provider value
with useContext
in <App>
:
…
Rendering initial state:
Updating state:
Class state
property must be an object since setState
takes an object of state variables to update.
Rendering initial state:
Updating state:
What are Gherkin feature files? They’re human-readable documentation that can map to automated tests.
Gherkin is a DSL (domain-specific language) for BDD (behavior-driven development).
Here’s an example of using Gherkin to describe how to search for remarkablemark
on Google:
Given I am on "https://www.google.com/"
When I click on the search bar
And I type "remarkablemark"
And I press "Enter"
Then I see in the search results "remarkablemark.org"
Each line is a step:
Given
sets up the scenario.When
describes the action.Then
states the expected outcome.And
chains successive Given
’s, When
’s, and Then
’s.Steps can be organized under Scenario
’s, and…
This article goes over how to remove Travis CI from your GitHub’s:
Revoke Travis CI from Account settings > Applications:
In Applications, check if Travis CI is added in:
Deny Travis CI access from Organization > Account settings > Third-party access:
This article describes the difference between planning, grooming, and estimation in agile methodology.
Based on the company goals and user research, the Product Manager (PM) comes up with the business case.
The Designer comes up with prototypes and conducts user testing. This happens during design sprints, which engineers can participate in the discussion and activity.
Once the business case is approved, the PM creates an initiative with an epic for spikes and tech designs. (See guide for writing technical specs.)
The Tech Lead (lead engineer) works on the tech design, which is reviewed by the team.
Once the tech design…
This article goes over how to deploy to Heroku using the GitHub Actions workflow.
Create a Heroku app and save the app’s name and email associated with your account. Then go to Account settings and copy your API Key
.
Go to your GitHub repository’s Settings
> Secrets
and set the secrets:
HEROKU_API_KEY
HEROKU_APP_NAME
HEROKU_EMAIL
Workflow to deploy using Deploy to Heroku action:
The action pushes to the main
branch.
Check out the additional options.
Workflow to deploy using a custom job:
The differences between the 2 workflows are explained below.
The Checkout action must fetch the entire Git…
Set an output parameter for .nvmrc
:
Evaluate the expression in setup-node
:
Here’s the full example of setting up Node.js with the .nvmrc
version in a GitHub Actions workflow:
The original solution is from @damccorm’s comment. The updated solution is from @peaceiris’s comment. Credit goes to them.
This article was originally published on remarkablemark.org on March 11, 2021.
What’s a story kickoff? Like the name implies, it’s an event to kick off the story with key stakeholders before working on it.
Why should development teams do story kickoffs? Because a story kickoff:
Every ticket goes through a lifecycle from Open
to Done
. Changes are cheaper when they’re introduced early on, and they get more expensive to implement later on.
Imagine a developer who goes down the wrong path and isn’t called out until the review stage. The…
Great organizations are transparent, and the best teams communicate openly.
Why is this important? Because public conversations promote knowledge sharing, while private discussions hide information.
To build a culture of high-performing teams, you need:
When implemented correctly, this creates a feedback loop of doing and learning.
Worst case scenario, public conversations generate a lot of noise. But if we use the right tools, we have the ability to mute or remove ourselves from such conversations.
In the end, I would rather have a lot of noise than cricket silence. The former can be used to derive actionable insights, whereas the latter won’t help us achieve anything.
This article was originally published on remarkablemark.org on March 9, 2021.