-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46b9663
commit c82f62d
Showing
1 changed file
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,39 @@ | ||
/// <reference types="vitest" /> | ||
|
||
import { defineConfig } from "vite"; | ||
import { vitestSetupFilePath, getClarinetVitestsArgv } from "@hirosystems/clarinet-sdk/vitest"; | ||
import { | ||
vitestSetupFilePath, | ||
getClarinetVitestsArgv, | ||
} from "@hirosystems/clarinet-sdk/vitest"; | ||
|
||
/* | ||
In this file, Vitest is configured so that it works seamlessly with Clarinet and the Simnet. | ||
The `vitest-environment-clarinet` will initialise the clarinet-sdk | ||
and make the `simnet` object available globally in the test files. | ||
`vitestSetupFilePath` points to a file in the `@hirosystems/clarinet-sdk` package that does two things: | ||
- run `before` hooks to initialize the simnet and `after` hooks to collect costs and coverage reports. | ||
- load custom vitest matchers to work with Clarity values (such as `expect(...).toBeUint()`) | ||
The `getClarinetVitestsArgv()` will parse options passed to the command `vitest run --` | ||
- vitest run -- --manifest ./Clarinet.toml # pass a custom path | ||
- vitest run -- --coverage --costs # collect coverage and cost reports | ||
*/ | ||
|
||
console.log(vitestSetupFilePath); | ||
export default defineConfig({ | ||
test: { | ||
environment: "clarinet", | ||
environment: "clarinet", // use vitest-environment-clarinet | ||
singleThread: true, | ||
setupFiles: [vitestSetupFilePath], | ||
setupFiles: [ | ||
vitestSetupFilePath, | ||
// custom setup files can be added here | ||
], | ||
environmentOptions: { | ||
clarinet: getClarinetVitestsArgv(), | ||
clarinet: { | ||
...getClarinetVitestsArgv(), | ||
// add or override options | ||
}, | ||
}, | ||
}, | ||
}); |