Skip to content

Commit 98ee87d

Browse files
Dan MullerAlex Eagle
authored andcommitted
feat(cypress): remove browiserify preprocessor
1 parent 9745e66 commit 98ee87d

File tree

11 files changed

+313
-2957
lines changed

11 files changed

+313
-2957
lines changed

docs/Cypress.html

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Cypress.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ The Cypress rules run tests under the Cypress e2e testing framework with Bazel.
1717

1818
## Installation
1919

20-
Add `@bazel/cypress`, `cypress` and `@cypress/browserify-preprocessor` npm packages to your `devDependencies` in `package.json`.
20+
Add `@bazel/cypress` and `cypress` npm packages to your `devDependencies` in `package.json`.
2121

2222
```
23-
npm install --save-dev @bazel/cypress cypress @cypress/browserify-preprocessor
23+
npm install --save-dev @bazel/cypress cypress
2424
```
2525
or using yarn
2626
```
27-
yarn add -D @bazel/cypress cypress @cypress/browserify-preprocessor
27+
yarn add -D @bazel/cypress cypress
2828
```
2929

3030
Then, load and invoke `cypress_repository` within your `WORKSPACE` file.

examples/cypress/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"@bazel/cypress": "^2.2.2",
1010
"@bazel/ibazel": "^0.13.2",
1111
"@bazel/typescript": "^2.2.2",
12-
"@cypress/browserify-preprocessor": "^3.0.0",
1312
"@types/node": "14.0.13",
1413
"cypress": "^4.8.0",
1514
"rxjs": "^6.5.2",
@@ -18,4 +17,4 @@
1817
"scripts": {
1918
"test": "bazel test //..."
2019
}
21-
}
20+
}

packages/cypress/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ pkg_npm(
9595
"@build_bazel_rules_nodejs//packages/cypress:internal/plugins/base.js": "TEMPLATED_node_modules_workspace_name//@bazel/cypress:internal/plugins/base.js",
9696
"@build_bazel_rules_nodejs//packages/cypress:internal/plugins/index.template.js": "TEMPLATED_node_modules_workspace_name//@bazel/cypress:internal/plugins/index.template.js",
9797
"@build_bazel_rules_nodejs//packages/cypress:internal/run-cypress.js": "TEMPLATED_node_modules_workspace_name//@bazel/cypress:internal/run-cypress.js",
98-
"\\${cwd}/../cypress_deps/node_modules/@cypress/browserify-preprocessor/index": "@cypress/browserify-preprocessor",
9998
},
10099
deps = [
101100
":npm_version_check",

packages/cypress/install.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ The Cypress rules run tests under the Cypress e2e testing framework with Bazel.
44

55
## Installation
66

7-
Add `@bazel/cypress`, `cypress` and `@cypress/browserify-preprocessor` npm packages to your `devDependencies` in `package.json`.
7+
Add `@bazel/cypress` and `cypress` npm packages to your `devDependencies` in `package.json`.
88

99
```
10-
npm install --save-dev @bazel/cypress cypress @cypress/browserify-preprocessor
10+
npm install --save-dev @bazel/cypress cypress
1111
```
1212
or using yarn
1313
```
14-
yarn add -D @bazel/cypress cypress @cypress/browserify-preprocessor
14+
yarn add -D @bazel/cypress cypress
1515
```
1616

1717
Then, load and invoke `cypress_repository` within your `WORKSPACE` file.

packages/cypress/internal/cypress_repository.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ def _cypress_repository_impl(repository_ctx):
2727
{},
2828
)
2929

30+
repository_ctx.template(
31+
"plugins/base.js",
32+
repository_ctx.path(repository_ctx.attr._base_plugin),
33+
{},
34+
)
35+
3036
repository_ctx.template(
3137
"packages/cypress/internal/cypress_web_test.bzl",
3238
repository_ctx.path(repository_ctx.attr._cypress_web_test),
@@ -59,6 +65,10 @@ cypress_repository = repository_rule(
5965
default = True,
6066
doc = "If stdout and stderr should be printed to the terminal",
6167
),
68+
"_base_plugin": attr.label(
69+
allow_single_file = True,
70+
default = "//packages/cypress:internal/plugins/base.js",
71+
),
6272
"_cypress_web_test": attr.label(
6373
allow_single_file = True,
6474
default = "//packages/cypress:internal/template.cypress_web_test.bzl",
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {join, normalize} = require('path');
1+
const {join} = require('path');
22

33
const basePluginShortPath = 'TEMPLATED_pluginsFile';
44
const integrationFileShortPaths = TEMPLATED_integrationFileShortPaths;
@@ -7,9 +7,6 @@ const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']);
77
const basePlugin = require(runfiles.resolveWorkspaceRelative(basePluginShortPath));
88
const cwd = process.cwd();
99

10-
const browserifyFactory = require(normalize(`TEMPLATED_@cypress/browserify-preprocessor`));
11-
const browserify = browserifyFactory(browserifyFactory.defaultOptions);
12-
1310
module.exports = (on, config) => {
1411
// Set env variables needed usually set by for `bazel test` invocations
1512
// (they are not set automatically for `bazel run`).
@@ -25,13 +22,6 @@ module.exports = (on, config) => {
2522
config.screenshotsFolder = process.env['TEST_UNDECLARED_OUTPUTS_DIR'] || process.env.RUNFILES_DIR;
2623
config.videosFolder = process.env['TEST_UNDECLARED_OUTPUTS_DIR'] || process.env.RUNFILES_DIR;
2724

28-
// Set file preprocessing output path to writable directory.
29-
on('file:preprocessor', (file) => {
30-
file.outputPath =
31-
join(process.env['TEST_TMPDIR'], file.outputPath.split('/bundles/').slice(1).join());
32-
return browserify(file);
33-
});
34-
3525
// Load in the user's cypress plugin
3626
return basePlugin(on, config);
3727
};

packages/cypress/internal/template.cypress_web_test.bzl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def _cypress_plugin_impl(ctx):
4040
output = ctx.outputs.plugin,
4141
template = ctx.file._plugin_template,
4242
substitutions = {
43-
"TEMPLATED_@cypress/browserify-preprocessor": "${cwd}/../cypress_deps/node_modules/@cypress/browserify-preprocessor/index",
4443
"TEMPLATED_integrationFileShortPaths": "[\n {files}\n]".format(files = ",\n ".join(integration_files_short_paths)),
4544
"TEMPLATED_pluginsFile": plugins_file.short_path,
4645
},
@@ -78,9 +77,7 @@ def cypress_web_test(
7877
name,
7978
config_file,
8079
srcs = [],
81-
plugins_file = Label("@build_bazel_rules_nodejs//packages/cypress:internal/plugins/base.js"),
82-
cypress = Label("TEMPLATED_node_modules_workspace_name//cypress:cypress"),
83-
cypress_browserify_preprocessor = Label("TEMPLATED_node_modules_workspace_name//@cypress/browserify-preprocessor"),
80+
plugins_file = Label("//plugins/base.js"),
8481
data = [],
8582
templated_args = [],
8683
cypress_cache = Label("//:cypress_cache"),
@@ -104,8 +101,6 @@ def cypress_web_test(
104101
tags = tags,
105102
data = data + [
106103
plugins_file,
107-
cypress,
108-
cypress_browserify_preprocessor,
109104
cypress_cache,
110105
cypress_executable,
111106
"{cypress_plugin}".format(cypress_plugin = cypress_plugin),
@@ -127,7 +122,6 @@ def cypress_web_test_global_cache(
127122
srcs = [],
128123
plugins_file = Label("@build_bazel_rules_nodejs//packages/cypress:plugins/base.js"),
129124
cypress = Label("TEMPLATED_node_modules_workspace_name//cypress:cypress"),
130-
cypress_browserify_preprocessor = Label("TEMPLATED_node_modules_workspace_name//@cypress/browserify-preprocessor"),
131125
data = [],
132126
templated_args = [],
133127
**kwargs):
@@ -150,7 +144,6 @@ def cypress_web_test_global_cache(
150144
data = data + [
151145
plugins_file,
152146
cypress,
153-
cypress_browserify_preprocessor,
154147
"{cypress_plugin}".format(cypress_plugin = cypress_plugin),
155148
"{config_file}".format(config_file = config_file),
156149
] + srcs,

packages/cypress/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "@bazel/cypress",
33
"peerDependencies": {
4-
"cypress": ">=4.7.0",
5-
"@cypress/browserify-preprocessor": ">=3.0.0"
4+
"cypress": ">=4.7.0"
65
},
76
"description": "Run Cypress e2e testing framework under Bazel",
87
"license": "Apache-2.0",
@@ -22,4 +21,4 @@
2221
"scripts": {
2322
"postinstall": "node npm_version_check.js"
2423
}
25-
}
24+
}

packages/cypress/test/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
"private": true,
44
"dependencies": {
55
"express": "4.17.1",
6-
"cypress": "^4.8.0",
7-
"@cypress/browserify-preprocessor": "^3.0.0",
6+
"cypress": "^5.2.0",
87
"@types/node": "14.0.14",
98
"rxjs": "^6.5.2",
109
"typescript": "3.9.5"

0 commit comments

Comments
 (0)