Skip to content

Commit 8854bfd

Browse files
mrmekualexeagle
authored andcommitted
feat: enable test file crawling for jest example
1 parent c83b026 commit 8854bfd

File tree

7 files changed

+1091
-856
lines changed

7 files changed

+1091
-856
lines changed

.vscode/settings.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"bazel.buildifierExecutable": "${workspaceFolder}/node_modules/.bin/buildifier",
32
"bazel.buildifierFixOnFormat": true
4-
}
3+
}

examples/jest/BUILD.bazel

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ load(":jest.bzl", "jest_test")
33
jest_test(
44
name = "test",
55
srcs = [
6+
"babel.config.js",
7+
"extra.js",
8+
"index.js",
69
"index.test.js",
710
"index2.test.js",
811
],
@@ -16,9 +19,6 @@ jest_test(
1619
"no-bazelci-mac",
1720
],
1821
deps = [
19-
"babel.config.js",
20-
"extra.js",
21-
"index.js",
2222
"@npm//@babel/core",
2323
"@npm//@babel/preset-env",
2424
"@npm//@jest/transform",

examples/jest/WORKSPACE

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
2929

3030
yarn_install(
3131
name = "npm",
32+
data = [
33+
"//:patches/jest-haste-map+24.9.0.patch",
34+
],
3235
package_json = "//:package.json",
3336
quiet = False,
3437
yarn_lock = "//:yarn.lock",

examples/jest/jest.bzl

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ def jest_test(name, srcs, deps, jest_config, **kwargs):
1010
"--ci",
1111
]
1212
args.extend(["--config", "$(location %s)" % jest_config])
13-
for src in srcs:
14-
args.extend(["--runTestsByPath", "$(location %s)" % src])
1513

1614
_jest_test(
1715
name = name,

examples/jest/package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99
"@jest/transform": "24.7.1",
1010
"babel-jest": "24.7.1",
1111
"babel-plugin-istanbul": "5.1.2",
12-
"jest-cli": "24.7.1",
13-
"jest-config": "24.7.1",
14-
"jest-haste-map": "24.7.1",
15-
"jest-resolve": "24.7.1",
16-
"jest-runtime": "24.7.1"
12+
"jest-cli": "24.9.0",
13+
"patch-package": "^6.2.0"
1714
},
1815
"scripts": {
16+
"postinstall": "patch-package",
1917
"test": "bazel test ..."
2018
}
2119
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/node_modules/jest-haste-map/build/crawlers/node.js b/node_modules/jest-haste-map/build/crawlers/node.js
2+
index 23985ae..a728a9a 100644
3+
--- a/node_modules/jest-haste-map/build/crawlers/node.js
4+
+++ b/node_modules/jest-haste-map/build/crawlers/node.js
5+
@@ -166,7 +166,11 @@ function find(roots, extensions, ignore, callback) {
6+
7+
function findNative(roots, extensions, ignore, callback) {
8+
const args = Array.from(roots);
9+
+ args.push('(');
10+
args.push('-type', 'f');
11+
+ args.push('-o');
12+
+ args.push('-type', 'l');
13+
+ args.push(')');
14+
15+
if (extensions.length) {
16+
args.push('(');

0 commit comments

Comments
 (0)