Skip to content

Commit

Permalink
ci: split tests and example tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocaillard committed Mar 18, 2024
1 parent 1d4414b commit b536d26
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/run-cbtc-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Contracts unit tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- working-directory: ./example/cbtc
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm test
3 changes: 1 addition & 2 deletions .github/workflows/run-unit-tests.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ on:
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"test": "vitest run",
"test:watch": "chokidar \"tests/**/*.ts\" \"contracts/**/*.clar\" -c \"npm run test:coverage\"",
"test:coverage": "vitest run -- --coverage true",
"test:coverage": "vitest run -- --coverage",
"format": "prettier ./unit-tests --write"
},
"author": "",
Expand Down
6 changes: 5 additions & 1 deletion vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { defineConfig } from "vite";
import { vitestSetupFilePath, getClarinetVitestsArgv } from "@hirosystems/clarinet-sdk/vitest";
import {
vitestSetupFilePath,
getClarinetVitestsArgv,
} from "@hirosystems/clarinet-sdk/vitest";

export default defineConfig({
test: {
include: ["./unit-tests/**/*.test.ts"],
environment: "clarinet",
singleThread: true,
setupFiles: [vitestSetupFilePath],
Expand Down

0 comments on commit b536d26

Please sign in to comment.