Skip to content

Commit

Permalink
[grid] Running unit tests in GitHub Actions (UI) (#9179)
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol authored Feb 17, 2021
1 parent 2fa1a0c commit b69aa6a
Show file tree
Hide file tree
Showing 7 changed files with 45,848 additions and 247 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,19 @@ jobs:
env:
DISPLAY: :99
SELENIUM_BROWSER: firefox

# As soon as this gets merged https://github.com/facebook/jest/pull/9351, we should upgrade Jest and
# run bazel test javascript/grid-ui:test for these tests
grid_ui_unit_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout source tree
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '15.x'
- name: NPM install
run: cd javascript/grid-ui && npm install
- name: Run unit tests
run: cd javascript/grid-ui && npm test
31 changes: 21 additions & 10 deletions javascript/grid-ui/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
load("@npm//react-scripts:index.bzl", "react_scripts")
load("@npm//jest-cli:index.bzl", "jest_test")
load("@npm//react-scripts:index.bzl", "react_scripts", "react_scripts_test")
load("//common:defs.bzl", "zip_file")

_RUNTIME_DEPS = [
Expand All @@ -22,6 +21,10 @@ _RUNTIME_DEPS = [
"@npm//source-map-explorer",
]

_TESTS = [
"src/**/*.test.ts*",
]

copy_to_bin(
name = "copy_static_files",
srcs = glob(
Expand All @@ -30,6 +33,7 @@ copy_to_bin(
"public/css/*",
"src/**/*",
],
exclude = _TESTS,
) + [
"package.json",
"tsconfig.json",
Expand Down Expand Up @@ -68,19 +72,26 @@ zip_file(
],
)

jest_test(
copy_to_bin(
name = "copy_test_files",
srcs = glob(_TESTS),
)

react_scripts_test(
name = "test",
size = "small",
args = [
"--node_options=--require=./$(rootpath chdir.js)",
"test",
"--watchAll=false",
"--no-cache",
"--no-watchman",
"--ci",
"--colors",
"--config",
"$(location jest.config.js)",
],
data = [
"jest.config.js",
":build",
data = _RUNTIME_DEPS + [
"copy_test_files",
"@npm//@testing-library/jest-dom",
"@npm//@testing-library/react",
"@npm//@testing-library/user-event",
],
tags = ["no-bazelci-windows", "no-sandbox"],
)
35 changes: 0 additions & 35 deletions javascript/grid-ui/jest.config.js

This file was deleted.

Loading

0 comments on commit b69aa6a

Please sign in to comment.