diff --git a/packages/compiler-cli/test/compliance/README.md b/packages/compiler-cli/test/compliance/README.md index 25ed1621d0..77dde089aa 100644 --- a/packages/compiler-cli/test/compliance/README.md +++ b/packages/compiler-cli/test/compliance/README.md @@ -114,7 +114,6 @@ yarn test-ivy-aot //packages/compiler-cli/test/compliance/test_cases/... (The last command runs the partial compilation tests.) - ## Updating a golden partial file There is one golden partial file per `TEST_CASES.json` file. So even if this file defines multiple @@ -137,11 +136,22 @@ that contains the `GOLDEN_PARTIAL.js` to update. ## Debugging test-cases -Compliance tests are basically `jasmine_node_test` rules. As such, they can be debugged -just like any other `jasmine_node_test`. The standard approach is to add `--config=debug` +The full and linked compliance tests are basically `jasmine_node_test` rules. As such, they can be +debugged just like any other `jasmine_node_test`. The standard approach is to add `--config=debug` to the Bazel test command. -It is useful when debugging to focus on a single test-case. +For example: + +```sg +yarn test-ivy-aot //packages/compiler-cli/test/compliance/full --config=debug +yarn test-ivy-aot //packages/compiler-cli/test/compliance/linked --config=debug +``` + +To debug generating the partial golden output use the following form of Bazel command: + +```sh +yarn bazel run //packages/compiler-cli/test/compliance/test_cases:generate_partial_for_.debug +``` ### Focusing test-cases @@ -154,4 +164,3 @@ This is equivalent to using jasmine `fit()`. You can exclude a test case by setting `"excludeTest": true` in the `TEST_CASES.json` file. This is equivalent to using jasmine `xit()`. - diff --git a/packages/compiler-cli/test/compliance/partial/partial_compliance_goldens.bzl b/packages/compiler-cli/test/compliance/partial/partial_compliance_goldens.bzl index 5ebd956a98..ea296400cd 100644 --- a/packages/compiler-cli/test/compliance/partial/partial_compliance_goldens.bzl +++ b/packages/compiler-cli/test/compliance/partial/partial_compliance_goldens.bzl @@ -6,26 +6,39 @@ def partial_compliance_golden(filePath): # Remove the "TEST_CASES.json" substring from the end of the provided path. path = filePath[:-len("/TEST_CASES.json")] + generate_partial_name = "generate_partial_for_%s" % path + data = [ + "//packages/compiler-cli/test/compliance/partial:generate_golden_partial_lib", + "//packages/compiler-cli/test/compliance/test_cases", + "//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package", + ] nodejs_binary( - name = "_generate_%s" % path, + name = generate_partial_name, testonly = True, - data = [ - "//packages/compiler-cli/test/compliance/partial:generate_golden_partial_lib", - "//packages/compiler-cli/test/compliance/test_cases", - "//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package", - ], + data = data, visibility = [":__pkg__"], entry_point = "//packages/compiler-cli/test/compliance/partial:cli.ts", templated_args = [ - # "--node_options=--inspect-brk", + filePath, + ], + ) + + nodejs_binary( + name = generate_partial_name + ".debug", + testonly = True, + data = data, + visibility = [":__pkg__"], + entry_point = "//packages/compiler-cli/test/compliance/partial:cli.ts", + templated_args = [ + "--node_options=--inspect-brk", filePath, ], ) npm_package_bin( name = "_generated_%s" % path, - tool = "_generate_%s" % path, + tool = generate_partial_name, testonly = True, stdout = "%s/this_file_should_not_be_committed" % path, link_workspace_root = True, @@ -34,11 +47,7 @@ def partial_compliance_golden(filePath): "no-windows", ], visibility = [":__pkg__"], - data = [ - "//packages/compiler-cli/test/compliance/partial:generate_golden_partial_lib", - "//packages/compiler-cli/test/compliance/test_cases", - "//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package", - ], + data = data, ) generated_file_test(