
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
cypress-codegen
Advanced tools
A [Cypress](https://www.cypress.io/) plugin which automatically adds and enables IntelliSense for your [custom commands](https://docs.cypress.io/api/cypress-api/custom-commands)!
A Cypress plugin 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/dist/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;
}
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.json
:
{
"env": {
"CODEGEN": false
}
}
FAQs
[](https://github.com/ExpediaGroup/cypress-codegen/actions?query=workflow%3ARelease) [](https://ww
The npm package cypress-codegen receives a total of 1,224 weekly downloads. As such, cypress-codegen popularity was classified as popular.
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.