-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from threlte/types
Add type export
- Loading branch information
Showing
7 changed files
with
105 additions
and
27 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@threlte/test': patch | ||
--- | ||
|
||
Add type export |
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
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
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 +1,55 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
import * as Svelte from 'svelte' | ||
import * as THREE from 'three' | ||
import type { ThrelteContext } from '@threlte/core' | ||
import type { IntersectionEvent } from '@threlte/extras' | ||
|
||
export { act, cleanup, render } from './pure' | ||
|
||
type ThrelteEvents = | ||
| 'click' | ||
| 'contextmenu' | ||
| 'dblclick' | ||
| 'wheel' | ||
| 'pointerup' | ||
| 'pointerdown' | ||
| 'pointerover' | ||
| 'pointerout' | ||
| 'pointerenter' | ||
| 'pointerleave' | ||
| 'pointermove' | ||
| 'pointermissed' | ||
|
||
export function act(fn?: (() => Promise<void>) | (() => void)): Promise<void> | ||
|
||
export function cleanup(): void | ||
|
||
export function render( | ||
component: typeof Svelte.SvelteComponent<any, any, any>, | ||
componentOptions?: { target: HTMLElement } & Record<string, unknown>, | ||
renderOptions?: { | ||
baseElement?: HTMLElement | ||
canvas?: HTMLCanvasElement | ||
userSize?: { width: number; height: number } | ||
} | ||
): { | ||
baseElement: HTMLElement | ||
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera | ||
component: Svelte.SvelteComponent<any, any, any> | ||
container: HTMLElement | ||
context: ThrelteContext | ||
scene: THREE.Scene | ||
|
||
advance: (options?: { count?: number; delta?: number }) => void | ||
|
||
fireEvent( | ||
object3D: THREE.Object3D, | ||
event: ThrelteEvents, | ||
payload: IntersectionEvent<ThrelteEvents> | ||
): Promise<void> | ||
|
||
rerender(props: Record<string, unknown>): Promise<void> | ||
|
||
unmount(): void | ||
} |
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
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
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,31 +1,20 @@ | ||
import { defineConfig } from 'vite' | ||
import { sveltekit } from '@sveltejs/kit/vite' | ||
import { threlteTesting } from './src/lib/plugin' | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig(({ mode }) => { | ||
return { | ||
plugins: [sveltekit()], | ||
resolve: { | ||
/* | ||
* Ensure `browser` exports are used in tests | ||
* Vitest prefers modules' `node` export by default | ||
* Svelte's `node` export is its SSR bundle, which does not have onMount | ||
* https://github.com/testing-library/svelte-testing-library/issues/222#issuecomment-1909993331 | ||
*/ | ||
conditions: mode === 'test' ? ['browser'] : [], | ||
export default defineConfig({ | ||
plugins: [sveltekit(), threlteTesting()], | ||
ssr: { | ||
noExternal: ['three'], | ||
}, | ||
test: { | ||
coverage: { | ||
include: ['src'], | ||
provider: 'v8', | ||
}, | ||
ssr: { | ||
noExternal: ['three'], | ||
}, | ||
test: { | ||
coverage: { | ||
include: ['src'], | ||
provider: 'v8', | ||
}, | ||
environment: 'jsdom', | ||
mockReset: true, | ||
setupFiles: ['./src/lib/vitest.js'], | ||
unstubGlobals: true, | ||
}, | ||
} | ||
environment: 'jsdom', | ||
mockReset: true, | ||
unstubGlobals: true, | ||
}, | ||
}) |