Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

tusk-test-runner-app-vitest-unit-tests.yml 3.5 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
  1. name: Tusk Test Runner - Vitest unit tests (src/app)
  2. # Required for Tusk
  3. permissions:
  4. contents: read
  5. on:
  6. workflow_dispatch:
  7. inputs:
  8. runId:
  9. description: 'Tusk Run ID'
  10. required: true
  11. tuskUrl:
  12. description: 'Tusk server URL'
  13. required: true
  14. commitSha:
  15. description: 'Commit SHA to checkout'
  16. required: true
  17. runnerIndexes:
  18. description: 'Runner indexes'
  19. required: false
  20. default: '["1"]'
  21. jobs:
  22. test-action:
  23. name: Tusk Test Runner
  24. runs-on: ubuntu-latest
  25. strategy:
  26. matrix:
  27. runnerIndex: ${{ fromJson(github.event.inputs.runnerIndexes) }}
  28. steps:
  29. - name: Checkout
  30. id: checkout
  31. uses: actions/checkout@v4
  32. with:
  33. ref: ${{ github.event.inputs.commitSha }} # Required for Tusk to access files for the commit being tested
  34. - name: Use Node
  35. uses: actions/setup-node@v4
  36. with:
  37. node-version-file: '.nvmrc'
  38. cache: 'npm'
  39. - name: Install Dependencies
  40. run: |
  41. npm ci
  42. npm install @vitest/coverage-v8
  43. - name: Start runner
  44. id: test-action
  45. uses: Use-Tusk/test-runner@v1
  46. # See https://github.com/Use-Tusk/test-runner for full details and examples.
  47. with:
  48. # Required to use parallelization
  49. runnerIndex: ${{ matrix.runnerIndex }}
  50. # Required for the test runner, do not remove this input
  51. runId: ${{ github.event.inputs.runId }}
  52. # Required for the test runner, do not remove this input
  53. tuskUrl: ${{ github.event.inputs.tuskUrl }}
  54. # Required for the test runner, do not remove this input
  55. commitSha: ${{ github.event.inputs.commitSha }}
  56. # Your Tusk auth token. It is recommended to add it to your repo's secrets.
  57. # Please adapt the secret name accordingly if you have named it differently.
  58. authToken: ${{ secrets.TUSK_AUTH_TOKEN }}
  59. # Vitest for the React app tests
  60. testFramework: 'vitest'
  61. # Test file regex to match Vitest test files in src/app
  62. testFileRegex: '^src/app/.*\.(test|spec)\.(js|jsx|ts|tsx)$'
  63. # This will be the working directory for all commands
  64. appDir: 'src/app'
  65. # The script to run to lint the code for React/TypeScript files
  66. lintScript: |
  67. set -e
  68. FILE_PATH="{{file}}"
  69. cd ../..
  70. # Adjust the file path to be relative to the root directory
  71. npx @biomejs/biome format --write "src/app/$FILE_PATH"
  72. npx @biomejs/biome lint --write "src/app/$FILE_PATH"
  73. cd src/app
  74. # Use incremental build to reduce latency for subsequent build checks
  75. # However, this means that we need to run with concurrency of 1 (on Tusk)
  76. npx tsc --build --noEmit --incremental
  77. # The script to run Vitest tests for individual files
  78. testScript: 'npx vitest run {{file}} --reporter=basic'
  79. coverageScript: |
  80. npx vitest run {{testFilePaths}} \
  81. --coverage \
  82. --coverage.reportsDirectory=coverage \
  83. --coverage.reporter=json-summary \
  84. --coverage.reporter=json \
  85. --coverage.reportOnFailure \
  86. --coverage.include="**/*.{ts,tsx}" \
  87. --coverage.exclude="**/*.{test,spec}.{ts,tsx}"
  88. # Max concurrency is set to 1 because we need to run tsc with incremental build
  89. maxConcurrency: 1
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...