Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

ts_web_test rule #72

Closed
wants to merge 4 commits into from
Closed

ts_web_test rule #72

wants to merge 4 commits into from

Conversation

alexeagle
Copy link
Contributor

@alexeagle alexeagle commented Nov 17, 2017

Some things to note about this approach:

  • We install a new external repo called build_bazel_rules_typescript_karma_deps that has all our runtime deps, so we don't mix with the users node_modules, and they don't even need to yarn add karma. That's good so we know we run a karma version that works with our rules.
  • Doesn't yet include any way to discover and connect to an existing karma instance, so it starts a bunch of browser windows, one per test target. Can add that later

/cc @bowenni

@alexeagle
Copy link
Contributor Author

Once we like the basic shape, I'll do a copybara import into google3 and mark some files as integrated (eg. the concatjs node impl) and we can do more review internally.

@alexeagle alexeagle changed the title WIP: ts_test rule ts_test rule Nov 27, 2017
substitutions = {
"TMPL_runfiles_path": "/".join([".."] * config_segments),
"TMPL_files": TMPL_files,
"TMPL_workspace_name": ctx.workspace_name,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find this in the template. Where is it used?

"TMPL_workspace_name": ctx.workspace_name,
})

ctx.actions.write(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the plan to have a karma_web_test_suite() or ts_web_test_suite() to run all of these Karma scripts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I want to understand from you :)
Right now each ts_test just runs karma on the conf file it produces

Copy link

@bowenni bowenni Dec 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My original plan was that ts_test()s don't run by themselves because starting multiple Karma instances is expensive. I wanted to have a top-level rule/script that starts the Karma instance and shares the instance across all ts_test()s that it depends on.
But as you said "Doesn't yet include any way to discover and connect to an existing karma instance, so it starts a bunch of browser windows, one per test target. Can add that later". So I'm OK with the current way it is.

testonly = 1,
)

ts_test(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't run tests by itself right?
Which rule consumes this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this does run the tests. I'll add a README about it

@alexeagle alexeagle changed the title ts_test rule ts_web_test rule Dec 12, 2017
Copy link

@bowenni bowenni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexeagle alexeagle closed this in 491949f Dec 14, 2017
@alexeagle alexeagle deleted the ts_test branch December 15, 2017 04:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants