defs
Public API re-exports
Macros and Functions
cypress_module_test
cypress_module_test creates a node environment which is hooked up to the cypress toolchain.
The environment is bootstrapped by first setting the environment variable CYPRESS_RUN_BINARY
to the binary downloaded by the cypress toolchain. See https://docs.cypress.io/guides/references/advanced-installation#Run-binary
You will provide a test runner, via the runner attribute, which is expected to call into cypress's module API to bootstrap testing.
Example runner.js
:
const cypress = require('cypress')
cypress.run({
headless: true,
}).then(result => {
if (result.status === 'failed') {
process.exit(1);
}
})
In most scenarios, it is easier to use cypress_test. But in some scenarios, you may need more flexibility:
- Accessing to the test results directly after the run and do something with them.
- Reruning a failing spec file
- Kicking off other builds or scripts
Example usage (generated):
load("@aspect_rules_cypress//cypress:defs.bzl", "cypress_module_test")
cypress_module_test(
# The name used for this rule and output files
name = "",
# JS file to call into the cypress module api
runner = None,
)
name
Required.
The name used for this rule and output files
runner
Required.
JS file to call into the cypress module api See https://docs.cypress.io/guides/guides/module-api
cypress
Optional. Default: "//:node_modules/cypress"
The cypress npm package which was already linked using an API like npm_link_all_packages.
kwargs
Optional.
All other args from js_test
. See https://github.com/aspect-build/rules_js/blob/main/docs/js_binary.md#js_test
cypress_test
cypress_test runs the cypress CLI with the cypress toolchain.
The environment is bootstrapped by first setting the environment variable CYPRESS_RUN_BINARY
to the binary downloaded by the cypress toolchain. See https://docs.cypress.io/guides/references/advanced-installation#Run-binary
See documentation on what arguments the cypress CLI supports: https://docs.cypress.io/guides/guides/command-line#What-you-ll-learn
Example usage (generated):
load("@aspect_rules_cypress//cypress:defs.bzl", "cypress_test")
cypress_test(
# The name used for this rule and output files
name = "",
)
name
Required.
The name used for this rule and output files
cypress
Optional. Default: "//:node_modules/cypress"
The cypress npm package which was already linked using an API like npm_link_all_packages.
kwargs
Optional.
All other args from js_test
. See https://github.com/aspect-build/rules_js/blob/main/docs/js_binary.md#js_test