Skip to content

Commit

Permalink
chore: code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Jan 27, 2022
1 parent 0bb1222 commit e6c16db
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 28 deletions.
3 changes: 3 additions & 0 deletions docs/Jasmine.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,15 @@ Defaults to `None`
<h4 id="jasmine_node_test-jasmine">jasmine</h4>

A label providing the `@bazel/jasmine` npm dependency.
Intended for internal use only.

Defaults to `None`

<h4 id="jasmine_node_test-jasmine_entry_point">jasmine_entry_point</h4>

A label providing the `@bazel/jasmine` entry point.
This is a custom wrapper which adds features like sharding and ibazel support.
Intended for internal use only.

Defaults to `None`

Expand Down
16 changes: 10 additions & 6 deletions internal/npm_install/generate_build_file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,17 @@ async function generatePackageBuildFiles(pkg: Dep) {


const indexFile = printIndexBzl(pkg);
const indexFileName = hasIndexBzl ? 'private.bzl' : 'index.bzl'
if (indexFile.length) {
await writeFile(path.posix.join(pkg._dir, indexFileName), indexFile);
buildFile += `
# For integration testing
exports_files(["${indexFileName}"])
`;
await writeFile(path.posix.join(pkg._dir, hasIndexBzl ? 'private' : '', 'index.bzl'), indexFile);
const buildContent = `
# For integration testing
exports_files(["index.bzl"])
`;
if (hasIndexBzl) {
await writeFile(path.posix.join(pkg._dir, 'private', 'BUILD.bazel'), buildContent);
} else {
buildFile += buildContent;
}
}


Expand Down
17 changes: 11 additions & 6 deletions internal/npm_install/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,18 @@ async function generatePackageBuildFiles(pkg) {
}, Promise.resolve());
}
const indexFile = printIndexBzl(pkg);
const indexFileName = hasIndexBzl ? 'private.bzl' : 'index.bzl';
if (indexFile.length) {
await writeFile(path.posix.join(pkg._dir, indexFileName), indexFile);
buildFile += `
# For integration testing
exports_files(["${indexFileName}"])
`;
await writeFile(path.posix.join(pkg._dir, hasIndexBzl ? 'private' : '', 'index.bzl'), indexFile);
const buildContent = `
# For integration testing
exports_files(["index.bzl"])
`;
if (hasIndexBzl) {
await writeFile(path.posix.join(pkg._dir, 'private', 'BUILD.bazel'), buildContent);
}
else {
buildFile += buildContent;
}
}
if (!symlinkBuildFile) {
await writeFile(path.posix.join(pkg._dir, buildFilePath), generateBuildFileHeader(visibility) + buildFile);
Expand Down
9 changes: 7 additions & 2 deletions packages/jasmine/jasmine_node_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ than launching a test in Karma, for example.
"""

load("@rules_nodejs//nodejs:providers.bzl", "JSModuleInfo")
load("//packages/jasmine/private:jasmine_runner_test.bzl", "jasmine_runner_test")
load("//packages/jasmine/private:index.bzl", "bazel_jasmine_runner_test")
load("@build_bazel_rules_nodejs//internal/node:node.bzl", nodejs_test = "nodejs_test_macro")

def _js_sources_impl(ctx):
Expand Down Expand Up @@ -103,7 +103,12 @@ def jasmine_node_test(
More info: https://github.com/bazelbuild/rules_nodejs/pull/2576
jasmine: A label providing the `@bazel/jasmine` npm dependency.
Intended for internal use only.
jasmine_entry_point: A label providing the `@bazel/jasmine` entry point.
This is a custom wrapper which adds features like sharding and ibazel support.
Intended for internal use only.
**kwargs: Remaining arguments are passed to the test rule
"""
if kwargs.pop("coverage", False):
Expand Down Expand Up @@ -161,4 +166,4 @@ def jasmine_node_test(
**kwargs
)
else:
jasmine_runner_test(**kwargs)
bazel_jasmine_runner_test(**kwargs)
2 changes: 1 addition & 1 deletion packages/jasmine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"bazel"
],
"bin": {
"jasmine_runner": "jasmine_runner.js"
"bazel-jasmine-runner": "jasmine_runner.js"
},
"main": "index.js",
"dependencies": {
Expand Down
13 changes: 0 additions & 13 deletions packages/jasmine/private/jasmine_runner_test.bzl

This file was deleted.

0 comments on commit e6c16db

Please sign in to comment.