
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
"describe" and "it" are great, but they don't really speak and guide your thinking during the testing process. Jest-then provides new keywords to help give your tests meaning and differentiate between the Arrange Act Assert part of each test.
import "jest-then" // This make given, when, ... available as global variable
Feature( `A user can sign-in`, () => {
Scenario( `Success`, () => {
Given( () => {
// ... pre-conditions for scenario to work
When( authProvider.isAuthenticated() ).thenReturn( false )
When( authProvider.signup( credentials ) ).thenResolve()
} )
Then( `A loader is displayed`, async () => {
// ... code
} )
And( `A success message is passed to the view`, () => {
// ... code
} )
And( `User is redirected to home after a timeout`, async () => {
// ... code
} )
} )
Scenario( `Sign-up error`, () => {
Given( () => {
// ... pre-conditions for scenario to work
When( authProvider.isAuthenticated() ).thenReturn( false )
When( authProvider.signup( credentials ) ).thenReject( error )
} )
Then( `An error message is passed to the view`, async () => {
// ... code
} )
And( `Loader is disabled`, async () => {
// ... code
} )
// ... etc
} )
} )
Note, you can still use their full api. meaning you can use
xscenarioorscenario.onlyas you would withdescribeorit😇
| Keyword | Alias for |
|---|---|
| Scenario | describe |
| Feature | describe |
| Case | describe |
| Given | beforeEach |
| When | beforeEach |
| Then | test/it |
| And | test/it |
Under the hood, this thing uses javascript proxies. I only delegate to the original jest object so you're safe 🥳
FAQs
Dumb simple "Given when then" aliases for jest
We found that jest-then demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.