Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Chore: Investigate test/js taking too long in CI #1004

@greyscaled

Description

@greyscaled

Overview

@kylecarbs reported (using Data Dog):

Can we speed up test/js? Right now it takes ~6m (p50 time in DataDog).

This would not scale well and seems way too long for what it should be

Local Run

Interestingly, local runs are ~30 seconds

coder ~/Code/coder/site (main) $ yarn test
yarn run v1.22.18
$ jest --selectProjects test
Running one project: test
 PASS   test  src/api/index.test.ts (7.252 s)
 PASS   test  src/components/Form/index.test.tsx (10.685 s)
  ● Console

    console.warn
      Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.

      at css (node_modules/@material-ui/system/styleFunctionSx.js:75:13)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/Box.js:14:37)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/index.js:21:36)

 PASS   test  src/components/Snackbar/index.test.ts
 PASS   test  src/components/Table/Cells/UserCell.test.tsx
  ● Console

    console.warn
      Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.

      at css (node_modules/@material-ui/system/styleFunctionSx.js:75:13)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/Box.js:14:37)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/index.js:21:36)

 PASS   test  src/components/Table/Table.test.tsx
  ● Console

    console.warn
      Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.

      at css (node_modules/@material-ui/system/styleFunctionSx.js:75:13)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/Box.js:14:37)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/index.js:21:36)

 PASS   test  src/components/Form/FormTextField.test.tsx
 PASS   test  src/components/Button/SplitButton.test.tsx
 PASS   test  src/components/Navbar/UserDropdown/UserDropdown.test.tsx
 PASS   test  src/components/Form/FormCloseButton.test.tsx
 PASS   test  src/pages/login.test.tsx
  ● Console

    console.warn
      Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.

      at css (node_modules/@material-ui/system/styleFunctionSx.js:75:13)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/Box.js:14:37)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/index.js:21:36)

 PASS   test  src/components/AdminDropdown/AdminDropdown.test.tsx
 PASS   test  src/util/schedule.test.ts
 PASS   test  src/components/EmptyState/index.test.tsx
  ● Console

    console.warn
      Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.

      at css (node_modules/@material-ui/system/styleFunctionSx.js:75:13)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/Box.js:14:37)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/index.js:21:36)

 PASS   test  src/components/Header/index.test.tsx
  ● Console

    console.warn
      Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.

      at css (node_modules/@material-ui/system/styleFunctionSx.js:75:13)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/Box.js:14:37)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/index.js:21:36)

 PASS   test  src/util/combineClasses.test.ts
 PASS   test  src/forms/CreateTemplateForm.test.tsx
  ● Console

    console.warn
      Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.

      at css (node_modules/@material-ui/system/styleFunctionSx.js:75:13)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/Box.js:14:37)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/index.js:21:36)

 PASS   test  src/util/redirect.test.ts
 PASS   test  src/components/Navbar/NavbarView/NavbarView.test.tsx
 PASS   test  src/components/Button/LoadingButton.test.tsx
 PASS   test  src/hooks/events.test.ts
 PASS   test  src/util/ellipsizeText.test.ts
 PASS   test  src/forms/CreateWorkspaceForm.test.tsx
  ● Console

    console.warn
      Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.

      at css (node_modules/@material-ui/system/styleFunctionSx.js:75:13)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/Box.js:14:37)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/index.js:21:36)

 PASS   test  src/components/Icons/index.test.tsx
 PASS   test  src/util/events.test.ts
 PASS   test  src/util/array.test.ts
 PASS   test  src/components/ErrorSummary/index.test.tsx
 PASS   test  src/components/Workspace/Workspace.test.tsx
  ● Console

    console.warn
      Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.

      at css (node_modules/@material-ui/system/styleFunctionSx.js:75:13)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/Box.js:14:37)
      at Object.<anonymous> (node_modules/@material-ui/core/Box/index.js:21:36)

 PASS   test  src/components/CodeBlock/index.test.tsx
 PASS   test  src/components/SignIn/CliAuthToken.test.tsx
 PASS   test  src/components/CodeExample/CodeExample.test.tsx
 PASS   test  src/components/Form/PasswordField.test.tsx
 PASS   test  src/components/Loader/FullScreenLoader.test.tsx
 PASS   test  src/components/Page/Footer.test.tsx
 PASS   test  src/util/first-letter.test.ts

Test Suites: 34 passed, 34 total
Tests:       97 passed, 97 total
Snapshots:   0 total
Time:        26.985 s
Ran all test suites.
Done in 31.76s.

CI Action Analysis

test-js:
name: "test/js"
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: Cache Node
id: cache-node
uses: actions/cache@v3
with:
path: |
**/node_modules
.eslintcache
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
js-${{ runner.os }}-
# Go is required for uploading the test results to datadog
- uses: actions/setup-go@v3
with:
go-version: "~1.18"
- uses: actions/setup-node@v3
with:
node-version: "14"
- name: Install node_modules
run: ./scripts/yarn_install.sh
- name: Build frontend
run: yarn build
working-directory: site
- run: yarn test:coverage
working-directory: site
- uses: codecov/codecov-action@v3
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./site/coverage/lcov.info
flags: unittest-js
fail_ci_if_error: true
- name: Upload DataDog Trace
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_CATEGORY: unit
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: go run scripts/datadog-cireport/main.go site/test-results/junit.xml

Metadata

Metadata

Assignees

Labels

siteArea: frontend dashboard

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions