Skip to content

Commit

Permalink
fix(typescript): capture js files in outputs of ts_project if allow_js
Browse files Browse the repository at this point in the history
  • Loading branch information
noveyak authored and alexeagle committed Jan 24, 2021
1 parent 924fa41 commit 9d7827b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/typescript/internal/ts_project.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def ts_project_macro(
typing_maps_outs = []

if not emit_declaration_only:
js_outs.extend(_out_paths(srcs, out_dir, root_dir, False, ".js"))
js_outs.extend(_out_paths(srcs, out_dir, root_dir, allow_js, ".js"))
if source_map and not emit_declaration_only:
map_outs.extend(_out_paths(srcs, out_dir, root_dir, False, ".js.map"))
if declaration or composite:
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/test/ts_project/allow_js/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test")
load("//packages/typescript:index.bzl", "ts_project")

# Ensure that a.js produces outDir/a.js and outDir/a.d.ts
# Ensure that a.js produces outDir/a.js, outDir/a.d.ts, and outDir/a.d.ts.map
SRCS = [
"a.js",
]
Expand Down
3 changes: 2 additions & 1 deletion packages/typescript/test/ts_project/allow_js/verify.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const assert = require('assert');

const types_files = process.argv.slice(2, 4);
const code_files = process.argv.slice(4, 6);
const code_file = process.argv[4];
assert.ok(types_files.some(f => f.endsWith('out/a.d.ts')), 'Missing a.d.ts');
assert.ok(types_files.some(f => f.endsWith('out/a.d.ts.map')), 'Missing a.d.ts.map');
assert.ok(code_file.endsWith('out/a.js'), 'Missing a.js');

0 comments on commit 9d7827b

Please sign in to comment.