2023-05-24 23:35:44 +00:00
import { defineWorkspace } from "vitest/config" ;
2023-06-01 20:41:30 +00:00
const packagedEmbedTestsOnly = process . argv . includes ( "--packaged-embed-tests-only" ) ;
2023-10-25 13:18:25 +00:00
const timeZoneDependentTestsOnly = process . argv . includes ( "--timeZoneDependentTestsOnly" ) ;
// eslint-disable-next-line turbo/no-undeclared-env-vars
const envTZ = process . env . TZ ;
if ( timeZoneDependentTestsOnly && ! envTZ ) {
throw new Error ( "TZ environment variable is not set" ) ;
}
2023-05-24 23:35:44 +00:00
// defineWorkspace provides a nice type hinting DX
2023-06-01 20:41:30 +00:00
const workspaces = packagedEmbedTestsOnly
? [
{
test : {
include : [ "packages/embeds/**/*.{test,spec}.{ts,js}" ] ,
environment : "jsdom" ,
} ,
} ,
]
2023-10-25 13:18:25 +00:00
: // It doesn't seem to be possible to fake timezone per test, so we rerun the entire suite with different TZ. See https://github.com/vitest-dev/vitest/issues/1575#issuecomment-1439286286
timeZoneDependentTestsOnly
? [
{
test : {
name : ` TimezoneDependentTests: ${ envTZ } ` ,
include : [ "packages/**/*.timezone.test.ts" , "apps/**/*.timezone.test.ts" ] ,
// TODO: Ignore the api until tests are fixed
exclude : [ "**/node_modules/**/*" , "packages/embeds/**/*" ] ,
setupFiles : [ "setupVitest.ts" ] ,
} ,
} ,
]
2023-06-01 20:41:30 +00:00
: [
{
test : {
include : [ "packages/**/*.{test,spec}.{ts,js}" , "apps/**/*.{test,spec}.{ts,js}" ] ,
// TODO: Ignore the api until tests are fixed
2023-10-11 14:09:13 +00:00
exclude : [ "**/node_modules/**/*" , "packages/embeds/**/*" ] ,
2023-09-06 19:23:53 +00:00
setupFiles : [ "setupVitest.ts" ] ,
2023-06-01 20:41:30 +00:00
} ,
} ,
2023-10-25 13:18:25 +00:00
2023-06-01 20:41:30 +00:00
{
test : {
name : "@calcom/closecom" ,
include : [ "packages/app-store/closecom/**/*.{test,spec}.{ts,js}" ] ,
environment : "jsdom" ,
setupFiles : [ "packages/app-store/closecom/test/globals.ts" ] ,
} ,
} ,
2023-07-19 15:22:41 +00:00
{
test : {
globals : true ,
name : "ui/components" ,
include : [ "packages/ui/components/**/*.{test,spec}.{ts,js,tsx}" ] ,
environment : "jsdom" ,
setupFiles : [ "packages/ui/components/test-setup.ts" ] ,
} ,
} ,
2023-10-05 14:50:26 +00:00
{
test : {
globals : true ,
name : "EventTypeAppCardInterface components" ,
include : [ "packages/app-store/_components/**/*.{test,spec}.{ts,js,tsx}" ] ,
environment : "jsdom" ,
setupFiles : [ "packages/app-store/test-setup.ts" ] ,
} ,
} ,
2023-06-01 20:41:30 +00:00
] ;
export default d efineWorkspace ( workspaces ) ;