Skip to content

Commit

Permalink
feat: enable test file crawling for jest example
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmeku committed Dec 26, 2019
1 parent 332b47c commit 071c26f
Show file tree
Hide file tree
Showing 7 changed files with 1,105 additions and 856 deletions.
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"bazel.buildifierExecutable": "${workspaceFolder}/node_modules/.bin/buildifier",
"bazel.buildifierFixOnFormat": true
}
}
6 changes: 3 additions & 3 deletions examples/jest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ load(":jest.bzl", "jest_test")
jest_test(
name = "test",
srcs = [
"babel.config.js",
"extra.js",
"index.js",
"index.test.js",
"index2.test.js",
],
Expand All @@ -16,9 +19,6 @@ jest_test(
"no-bazelci-mac",
],
deps = [
"babel.config.js",
"extra.js",
"index.js",
"@npm//@babel/core",
"@npm//@babel/preset-env",
"@npm//@jest/transform",
Expand Down
3 changes: 3 additions & 0 deletions examples/jest/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")

yarn_install(
name = "npm",
data = [
"//:patches/jest-haste-map+24.9.0.patch",
],
package_json = "//:package.json",
quiet = False,
yarn_lock = "//:yarn.lock",
Expand Down
2 changes: 0 additions & 2 deletions examples/jest/jest.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ def jest_test(name, srcs, deps, jest_config, **kwargs):
"--ci",
]
args.extend(["--config", "$(location %s)" % jest_config])
for src in srcs:
args.extend(["--runTestsByPath", "$(location %s)" % src])

_jest_test(
name = name,
Expand Down
8 changes: 3 additions & 5 deletions examples/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
"@jest/transform": "24.7.1",
"babel-jest": "24.7.1",
"babel-plugin-istanbul": "5.1.2",
"jest-cli": "24.7.1",
"jest-config": "24.7.1",
"jest-haste-map": "24.7.1",
"jest-resolve": "24.7.1",
"jest-runtime": "24.7.1"
"jest-cli": "24.9.0",
"patch-package": "^6.2.0"
},
"scripts": {
"postinstall": "patch-package",
"test": "bazel test ..."
}
}
30 changes: 30 additions & 0 deletions examples/jest/patches/jest-haste-map+24.9.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/node_modules/jest-haste-map/build/crawlers/node.js b/node_modules/jest-haste-map/build/crawlers/node.js
index 23985ae..62c7f9c 100644
--- a/node_modules/jest-haste-map/build/crawlers/node.js
+++ b/node_modules/jest-haste-map/build/crawlers/node.js
@@ -168,9 +168,9 @@ function findNative(roots, extensions, ignore, callback) {
const args = Array.from(roots);
args.push('-type', 'f');

- if (extensions.length) {
- args.push('(');
- }
+ // if (extensions.length) {
+ // args.push('(');
+ // }

extensions.forEach((ext, index) => {
if (index) {
@@ -181,9 +181,9 @@ function findNative(roots, extensions, ignore, callback) {
args.push('*.' + ext);
});

- if (extensions.length) {
- args.push(')');
- }
+ // if (extensions.length) {
+ // args.push(')');
+ // }

const child = (0, _child_process().spawn)('find', args);
let stdout = '';
Loading

0 comments on commit 071c26f

Please sign in to comment.