Skip to content

Commit

Permalink
refactor: don't default chdir to package_name() in _cypress_test_macro (
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan authored May 14, 2024
1 parent 2c3142b commit 96ee05d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion cypress/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def _cypress_test_macro(name, entry_point, cypress, disable_sandbox, **kwargs):
data = kwargs.pop("data", []) + [
cypress,
],
chdir = native.package_name(),
enable_runfiles = select({
"@aspect_rules_js//js/private:enable_runfiles": True,
"//conditions:default": False,
Expand Down
2 changes: 1 addition & 1 deletion e2e/workspace/cli_test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cypress_test(
timeout = "short",
args = [
"run",
"--config-file=cypress.config.ts",
"--config-file=cli_test/cypress.config.ts",
],
data = [
"cli_test.cy.ts",
Expand Down
2 changes: 1 addition & 1 deletion e2e/workspace/cli_test/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ process.env.XVFB_DISPLAY_NUM = Math.floor(Math.random() * 99999).toString();

export default defineConfig({
e2e: {
specPattern: ["cli_test.cy.ts"],
specPattern: ["cli_test/cli_test.cy.ts"],
supportFile: false,
setupNodeEvents(on, config) {
on("before:browser:launch", (browser, launchOptions) => {
Expand Down
1 change: 1 addition & 0 deletions e2e/workspace/module_test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@aspect_rules_cypress//cypress:defs.bzl", "cypress_module_test")
cypress_module_test(
name = "module_test",
timeout = "short",
chdir = package_name(),
data = [
"cypress.config.js",
"module_test.cy.js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/workspace/server_example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cypress_test(
timeout = "short",
args = [
"run",
"--config-file=cypress.config.js",
"--config-file=server_example/cypress.config.js",
],
data = [
"cypress.config.js",
Expand Down
4 changes: 2 additions & 2 deletions e2e/workspace/server_example/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process.env.XVFB_DISPLAY_NUM = Math.floor(Math.random() * 99999).toString();

module.exports = defineConfig({
e2e: {
specPattern: ["server_example_test.cy.js"],
specPattern: ["server_example/server_example_test.cy.js"],
supportFile: false,
setupNodeEvents(on, config) {
// Use "before:browser:launch" to edit config values.
Expand All @@ -20,7 +20,7 @@ module.exports = defineConfig({
const port = "3000";
return new Promise((resolve, reject) => {
// Launch the server
const serverProcess = spawn(join(__dirname, "server.sh"), [port], {
const serverProcess = spawn(join(process.cwd(), "server.sh"), [port], {
// js_binary expects to be run at execroot, but cypress rule has changed pwd to where our test target was defined.
cwd: `${process.env.TEST_SRCDIR}/${process.env.TEST_WORKSPACE}`,
});
Expand Down

0 comments on commit 96ee05d

Please sign in to comment.