Skip to content

Commit c8ad100

Browse files
committed
refactor(github-actions): move pull request labeling tests into lib directory (#3456)
PR Close #3456
1 parent 003fcc0 commit c8ad100

4 files changed

Lines changed: 33 additions & 448 deletions

File tree

github-actions/labeling/pull-request/BUILD.bazel

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
load("@devinfra_npm//:defs.bzl", "npm_link_all_packages")
2-
load("//tools:defaults.bzl", "esbuild_checked_in", "ts_project")
2+
load("//tools:defaults.bzl", "esbuild_checked_in", "jasmine_test", "ts_project")
33

44
package(default_visibility = ["//github-actions/labeling/pull-request:__subpackages__"])
55

66
npm_link_all_packages()
77

88
ts_project(
99
name = "lib",
10-
srcs = glob(["lib/*.ts"]),
10+
srcs = glob(
11+
["lib/*.ts"],
12+
exclude = ["lib/*.spec.ts"],
13+
),
1114
tsconfig = "//github-actions:tsconfig",
1215
deps = [
1316
":node_modules/@actions/core",
@@ -24,6 +27,26 @@ ts_project(
2427
],
2528
)
2629

30+
ts_project(
31+
name = "test_lib",
32+
testonly = True,
33+
srcs = glob([
34+
"lib/*.spec.ts",
35+
]),
36+
tsconfig = "//github-actions:tsconfig_test",
37+
visibility = [
38+
"//github-actions/labeling/pull-request:__subpackages__",
39+
],
40+
deps = [
41+
"//github-actions:node_modules/@types/jasmine",
42+
"//github-actions:node_modules/@types/node",
43+
"//github-actions/labeling/pull-request:lib",
44+
"//github-actions/labeling/pull-request:node_modules/@actions/core",
45+
"//github-actions/labeling/pull-request:node_modules/@actions/github",
46+
"//github-actions/labeling/pull-request:node_modules/@octokit/rest",
47+
],
48+
)
49+
2750
esbuild_checked_in(
2851
name = "main",
2952
srcs = [
@@ -34,3 +57,10 @@ esbuild_checked_in(
3457
platform = "node",
3558
target = "node22",
3659
)
60+
61+
jasmine_test(
62+
name = "test",
63+
data = [
64+
":test_lib",
65+
],
66+
)

github-actions/labeling/pull-request/test/pull-request-labeling.spec.ts renamed to github-actions/labeling/pull-request/lib/pull-request-labeling.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {PullRequestLabeling} from '../lib/pull-request-labeling.js';
1+
import {PullRequestLabeling} from './pull-request-labeling.js';
22
import {Octokit} from '@octokit/rest';
33

44
describe('PullRequestLabeling', () => {

0 commit comments

Comments
 (0)