Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update vitest config #109

Merged
merged 1 commit into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions apps/privelte/src/hooks.server.ts

This file was deleted.

8 changes: 4 additions & 4 deletions apps/privelte/src/routes/room/[id]/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const POST: RequestHandler = async ({ request, cookies, params }) => {
.throwOnError()
} catch (e) {
console.error(e)
return error(401, 'Unauthorized.')
error(401, 'Unauthorized.')
}

const body = (await request.json()) as Pick<Payload, 'id' | 'message'>
Expand All @@ -39,7 +39,7 @@ export const POST: RequestHandler = async ({ request, cookies, params }) => {
payload = { type: 'payload', id, message, userId, username }
} catch (e) {
console.error(e)
return error(400, 'Invalid ID or message.')
error(400, 'Invalid ID or message.')
}

const channel = supabase.channel(params.id, {
Expand All @@ -54,7 +54,7 @@ export const POST: RequestHandler = async ({ request, cookies, params }) => {
})

if (response !== 'ok') {
return error(500, { message: 'Internal error.' })
error(500, { message: 'Internal error.' })
}
} finally {
await supabase.removeChannel(channel)
Expand Down Expand Up @@ -86,7 +86,7 @@ export const PATCH: RequestHandler = async ({ cookies, params }) => {
})
} catch (e) {
console.error(e)
return error(401, 'Unauthorized.')
error(401, 'Unauthorized.')
}

return new Response(null, { status: 204 })
Expand Down
8 changes: 4 additions & 4 deletions apps/privelte/src/routes/room/[id]/join/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export const actions: Actions = {
const room = await supabase.from('rooms').select('*').eq('id', params.id!).single()

if (room.error) {
return error(404, { message: 'This room does not exist.' })
error(404, { message: 'This room does not exist.' })
}

const participants = room.data.participants ?? 0

if (participants === room.data.slots) {
return error(403, { message: 'This room is full.' })
error(403, { message: 'This room is full.' })
}

const form = await request.formData()
Expand All @@ -60,9 +60,9 @@ export const actions: Actions = {
})
} catch (e) {
console.error(e)
return error(500, { message: 'Internal error.' })
error(500, { message: 'Internal error.' })
}

return redirect(303, `/room/${params.id}`)
redirect(303, `/room/${params.id}`)
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/privelte/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const config = {
typescript: {
config: (config) => ({
...config,
include: [...config.include, '../tailwind.config.ts', '../vitest-setup.ts']
include: [...config.include, '../tailwind.config.ts']
})
},
paths: {
Expand Down
8 changes: 4 additions & 4 deletions apps/privelte/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { sveltekit } from '@sveltejs/kit/vite'
import { purgeCss } from 'vite-plugin-tailwind-purgecss'
import { defineConfig, type PluginOption } from 'vite'
import { defineConfig } from 'vite'

export default defineConfig(({ mode }) => ({
plugins: [sveltekit() as PluginOption, purgeCss()],
plugins: [sveltekit(), purgeCss()],
resolve: {
conditions: mode === 'test' ? ['browser'] : []
},
test: {
include: ['src/**/*.test.ts'],
environmentMatchGlobs: [['**/[A-Z]*.test.ts', 'happy-dom']],
setupFiles: ['./vitest-setup.ts']
environmentMatchGlobs: [['**/*.svelte.test.ts', 'happy-dom']],
setupFiles: ['./src/vitest-setup.ts']
}
}))
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/svelteflix/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const config = {
typescript: {
config: (config) => ({
...config,
include: [...config.include, '../tailwind.config.ts', '../vitest-setup.ts']
include: [...config.include, '../tailwind.config.ts']
})
}
}
Expand Down
8 changes: 4 additions & 4 deletions apps/svelteflix/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig, type PluginOption } from 'vite'
import { defineConfig } from 'vite'

export default defineConfig({
plugins: [sveltekit() as PluginOption],
plugins: [sveltekit()],
test: {
include: ['src/**/*.test.ts'],
environmentMatchGlobs: [['**/[A-Z]*.test.ts', 'happy-dom']],
setupFiles: ['./vitest-setup.ts']
environmentMatchGlobs: [['**/*.svelte.test.ts', 'happy-dom']],
setupFiles: ['./src/vitest-setup.ts']
}
})
Loading