diff --git a/cypress/defs.bzl b/cypress/defs.bzl index 4d83a47..76ae9ab 100644 --- a/cypress/defs.bzl +++ b/cypress/defs.bzl @@ -78,8 +78,7 @@ def cypress_module_test(name, runner, cypress = "//:node_modules/cypress", **kwa cypress.run({ headless: true, }).then(result => { - // Cypress only reports a status on failures - if (result.status) { + if (result.status === 'failed') { process.exit(1); } }) diff --git a/docs/defs.md b/docs/defs.md index 3ecf02f..93087cd 100644 --- a/docs/defs.md +++ b/docs/defs.md @@ -23,8 +23,7 @@ const cypress = require('cypress') cypress.run({ headless: true, }).then(result => { -// Cypress only reports a status on failures -if (result.status) { +if (result.status === 'failed') { process.exit(1); } }) diff --git a/docs/rules.md b/docs/rules.md index 169f9ed..4e073e5 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -33,8 +33,7 @@ async function main() { process.exit(1) } - // Cypress only reports a status on failures - if (result.status) { + if (result.status === 'failed') { console.error('Cypress tests failed with status', result.status) process.exit(2) } diff --git a/e2e/workspace/MODULE.bazel b/e2e/workspace/MODULE.bazel index 0a87afb..3bddeed 100644 --- a/e2e/workspace/MODULE.bazel +++ b/e2e/workspace/MODULE.bazel @@ -3,9 +3,11 @@ local_path_override( module_name = "aspect_rules_cypress", path = "../..", ) + cypress = use_extension("@aspect_rules_cypress//cypress:extensions.bzl", "cypress") cypress.toolchain(cypress_version = "13.6.6") use_repo(cypress, "cypress_toolchains") + register_toolchains("@cypress_toolchains//:all") bazel_dep(name = "aspect_rules_js", version = "1.41.2", dev_dependency = True) diff --git a/e2e/workspace/module_test/runner.js b/e2e/workspace/module_test/runner.js index 9d962cd..e3ef987 100644 --- a/e2e/workspace/module_test/runner.js +++ b/e2e/workspace/module_test/runner.js @@ -12,9 +12,7 @@ async function main() { return 1; } - // Cypress only reports a status on failures - if (result.status) { - console.error("Cypress tests failed with status", result.status); + if (result.status === "failed") { return 2; }