Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
cypress-codegen
Advanced tools
[![GitHub Actions CI](https://github.com/ExpediaGroup/cypress-codegen/workflows/Release/badge.svg)](https://github.com/ExpediaGroup/cypress-codegen/actions?query=workflow%3ARelease) [![npm version](https://badge.fury.io/js/cypress-codegen.svg)](https://ww
A Cypress plugin and CLI tool which automatically adds and enables IntelliSense for your custom commands!
The process for adding Cypress custom commands to test suites is quite manual and involves bloating projects with too much boilerplate code.
Additionally, custom commands are hard to write because we don't get IntelliSense or the ease of navigating to the command's definition.
The cypress-codegen
plugin will dynamically import all of your project's custom commands and will even enable IntelliSense and "go to definition" shortcuts!
npm i --save-dev cypress-codegen
Model your Cypress project exactly like the one in this repository!
cypress.config.ts
like so:import { cypressCodegen } from 'cypress-codegen/plugin';
import { defineConfig } from 'cypress';
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
cypressCodegen(on, config);
return config;
}
},
component: {
setupNodeEvents(on, config) {
cypressCodegen(on, config);
return config;
},
devServer: {
framework: 'create-react-app',
bundler: 'webpack'
}
}
});
cypress/support/component.ts
and/or cypress/support/e2e.ts
:import 'cypress-codegen';
Put all of your custom commands in cypress/commands
as regular functions. It is recommended to separate each command into its own file of the same name.
Run any Cypress test, and cypress-codegen
will:
Check out this project's cypress
directory for a generic example!
If you want to create custom commands that are meant to be scoped to a previous command's result, put Scoped
at the
end of your custom command function name (e.g. myCustomCommandScoped
). This will set the prevSubject
option when
adding the custom command. See the Cypress docs
for more details.
cypress-codegen
will attempt to read your prettierrc
config by default.
However, you may pass a config override in the cypress.config.ts invocation:
setupNodeEvents(on, config) {
cypressCodegen(on, config, prettierConfigOverride);
return config;
}
You can also run cypress-codegen
in your terminal to generate types for your Cypress project!
Optionally pass the --prettier-config
flag to pass in a stringified prettier config object.
If you are using the --project
flag when starting Cypress, you will need to set the Cypress environment variable PROJECT
to your project name.
In cypress.config.ts:
env: {
PROJECT: 'my-project';
}
The IntelliSense codegen feature is enabled by default.
To disable the codegen feature (perhaps for a Javascript Cypress project), set the CODEGEN
Cypress environment variable to false
.
You will still get the benefit of the custom commands being loaded automatically without even having to invoke Cypress.Commands.add()
!
CYPRESS_CODEGEN=false npx cypress run
or in cypress.config.js
:
env: {
CODEGEN: false;
}
FAQs
[![GitHub Actions CI](https://github.com/ExpediaGroup/cypress-codegen/workflows/Release/badge.svg)](https://github.com/ExpediaGroup/cypress-codegen/actions?query=workflow%3ARelease) [![npm version](https://badge.fury.io/js/cypress-codegen.svg)](https://ww
We found that cypress-codegen demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.