@quilted/react-testing
Advanced tools
Comparing version 0.0.0-preview-20230318161322 to 0.0.0-preview-20230401011453
import type { ReactElement } from 'react'; | ||
import type { Node as BaseNode, Root as RootNode, PlainObject, EmptyObject, MergeObjects } from './types'; | ||
import type { Node as BaseNode, Root as RootNode, PlainObject, EmptyObject, MergeObjects } from './types.ts'; | ||
export type { BaseNode as Node, RootNode as Root }; | ||
@@ -4,0 +4,0 @@ export interface BaseNodeCreationOptions<T, Extensions extends PlainObject> { |
import type { VNode, Component } from 'preact'; | ||
import { isNode } from '../environment'; | ||
import type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption } from '../environment'; | ||
import type { Node, NodeApi, Root, RootApi, HtmlNodeExtensions } from '../types'; | ||
import { isNode } from '../environment.tsx'; | ||
import type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption } from '../environment.tsx'; | ||
import type { Node, NodeApi, Root, RootApi, HtmlNodeExtensions } from '../types.ts'; | ||
export { isNode }; | ||
export type { Node, NodeApi, Root, RootApi, HtmlNodeExtensions, CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption, }; | ||
declare const render: CustomRender<import("../types").EmptyObject, import("../types").EmptyObject, import("../types").EmptyObject, HtmlNodeExtensions, false>, createRender: <RenderOptions extends import("../types").PlainObject = import("../types").EmptyObject, Context_1 extends import("../types").PlainObject = import("../types").EmptyObject, Actions extends import("../types").PlainObject = import("../types").EmptyObject, Async extends boolean = false>(options: CustomRenderOptions<RenderOptions, Context_1, Context_1, Actions, Actions, HtmlNodeExtensions, Async>) => CustomRender<RenderOptions, Context_1, Actions, HtmlNodeExtensions, Async>, rendered: Set<Root<any, any, any, HtmlNodeExtensions>>, destroyAll: () => void; | ||
declare const render: CustomRender<import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, HtmlNodeExtensions, false>, createRender: <RenderOptions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Context_1 extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Actions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Async extends boolean = false>(options: CustomRenderOptions<RenderOptions, Context_1, Context_1, Actions, Actions, HtmlNodeExtensions, Async>) => CustomRender<RenderOptions, Context_1, Actions, HtmlNodeExtensions, Async>, rendered: Set<Root<any, any, any, HtmlNodeExtensions>>, destroyAll: () => void; | ||
export { render, createRender, rendered, destroyAll }; | ||
@@ -9,0 +9,0 @@ /** |
@@ -1,7 +0,7 @@ | ||
import { isNode } from '../environment'; | ||
import type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption } from '../environment'; | ||
import type { Node, NodeApi, Root, RootApi, HtmlNodeExtensions } from '../types'; | ||
import { isNode } from '../environment.tsx'; | ||
import type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption } from '../environment.tsx'; | ||
import type { Node, NodeApi, Root, RootApi, HtmlNodeExtensions } from '../types.ts'; | ||
export { isNode }; | ||
export type { Node, NodeApi, Root, RootApi, HtmlNodeExtensions, CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption, }; | ||
declare const render: CustomRender<import("../types").EmptyObject, import("../types").EmptyObject, import("../types").EmptyObject, HtmlNodeExtensions, false>, createRender: <RenderOptions extends import("../types").PlainObject = import("../types").EmptyObject, Context_1 extends import("../types").PlainObject = import("../types").EmptyObject, Actions extends import("../types").PlainObject = import("../types").EmptyObject, Async extends boolean = false>(options: CustomRenderOptions<RenderOptions, Context_1, Context_1, Actions, Actions, HtmlNodeExtensions, Async>) => CustomRender<RenderOptions, Context_1, Actions, HtmlNodeExtensions, Async>, rendered: Set<Root<any, any, any, HtmlNodeExtensions>>, destroyAll: () => void; | ||
declare const render: CustomRender<import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, HtmlNodeExtensions, false>, createRender: <RenderOptions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Context_1 extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Actions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Async extends boolean = false>(options: CustomRenderOptions<RenderOptions, Context_1, Context_1, Actions, Actions, HtmlNodeExtensions, Async>) => CustomRender<RenderOptions, Context_1, Actions, HtmlNodeExtensions, Async>, rendered: Set<Root<any, any, any, HtmlNodeExtensions>>, destroyAll: () => void; | ||
export { render, createRender, rendered, destroyAll }; | ||
@@ -8,0 +8,0 @@ type Create = Parameters<EnvironmentOptions<any, HtmlNodeExtensions>['update']>[1]; |
@@ -1,5 +0,5 @@ | ||
import type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption } from '../environment'; | ||
import type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption } from '../environment.tsx'; | ||
export type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption, }; | ||
declare const render: CustomRender<import("..").EmptyObject, import("..").EmptyObject, import("..").EmptyObject, import("..").EmptyObject, false>, createRender: <RenderOptions extends import("..").PlainObject = import("..").EmptyObject, Context_1 extends import("..").PlainObject = import("..").EmptyObject, Actions extends import("..").PlainObject = import("..").EmptyObject, Async extends boolean = false>(options: CustomRenderOptions<RenderOptions, Context_1, Context_1, Actions, Actions, import("..").EmptyObject, Async>) => CustomRender<RenderOptions, Context_1, Actions, import("..").EmptyObject, Async>, rendered: Set<import("../types").Root<any, any, any, import("..").EmptyObject>>, destroyAll: () => void; | ||
declare const render: CustomRender<import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, false>, createRender: <RenderOptions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Context_1 extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Actions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Async extends boolean = false>(options: CustomRenderOptions<RenderOptions, Context_1, Context_1, Actions, Actions, import("../types.ts").EmptyObject, Async>) => CustomRender<RenderOptions, Context_1, Actions, import("../types.ts").EmptyObject, Async>, rendered: Set<import("../types.ts").Root<any, any, any, import("../types.ts").EmptyObject>>, destroyAll: () => void; | ||
export { render, createRender, rendered, destroyAll }; | ||
//# sourceMappingURL=test-renderer.d.ts.map |
@@ -1,5 +0,5 @@ | ||
export * from './implementations/test-renderer'; | ||
export * from './types'; | ||
export { createEnvironment } from './environment'; | ||
export type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption, } from './environment'; | ||
export * from './implementations/test-renderer.ts'; | ||
export * from './types.ts'; | ||
export { createEnvironment } from './environment.tsx'; | ||
export type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption, } from './environment.tsx'; | ||
//# sourceMappingURL=index.d.ts.map |
import type { ComponentType } from 'react'; | ||
import type { MatcherState } from 'expect'; | ||
import { Node, PropsFor } from '../types'; | ||
import { Node, PropsFor } from '../types.ts'; | ||
export declare function toContainReactComponent<Type extends string | ComponentType<any>>(this: MatcherState, node: Node<any, any>, type: Type, props?: Partial<PropsFor<Type>>): { | ||
@@ -5,0 +5,0 @@ pass: boolean; |
import { Context } from 'react'; | ||
import type { MatcherState } from 'expect'; | ||
import { Node } from '../types'; | ||
import type { Node } from '../types.ts'; | ||
export declare function toProvideReactContext<Type>(this: MatcherState, node: Node<any, any>, Context: Context<Type>, value?: Type): { | ||
@@ -5,0 +5,0 @@ pass: boolean; |
import type { MatcherState } from 'expect'; | ||
import type { Node, HtmlNodeExtensions } from '../types'; | ||
import type { Node, HtmlNodeExtensions } from '../types.ts'; | ||
declare global { | ||
@@ -4,0 +4,0 @@ namespace jest { |
import type { ComponentType, Context as ReactContext } from 'react'; | ||
import type { Node, PropsFor } from '../types'; | ||
import type { Node, PropsFor } from '../types.ts'; | ||
type PropsFromNode<T> = NonNullable<T> extends Node<infer U, any> ? U : never; | ||
@@ -4,0 +4,0 @@ declare global { |
import type { MatcherState } from 'expect'; | ||
import type { Node } from '../types'; | ||
import type { Node } from '../types.ts'; | ||
export declare function toHaveReactProps<Props>(this: MatcherState, node: Node<Props, any>, props: Partial<Props>): { | ||
@@ -4,0 +4,0 @@ pass: boolean; |
import type { MatcherState } from 'expect'; | ||
import type { Node } from '../types'; | ||
import type { Node } from '../types.ts'; | ||
export declare function toContainReactText<Props>(this: MatcherState, node: Node<Props, any>, text: string): { | ||
@@ -4,0 +4,0 @@ pass: boolean; |
import type { ComponentType } from 'react'; | ||
import type { Node } from '../types'; | ||
import type { Node } from '../types.ts'; | ||
export declare function assertIsNode(node: unknown, { expectation, isNot }: { | ||
@@ -4,0 +4,0 @@ expectation: string; |
@@ -1,2 +0,2 @@ | ||
import type { DebugOptions, Node } from './types'; | ||
import type { DebugOptions, Node } from './types.ts'; | ||
export declare function toReactString<Props>(node: Node<Props, any> | string, options?: DebugOptions, level?: number): string; | ||
@@ -3,0 +3,0 @@ export declare function toPropString(key: string, value: unknown, verbosity?: number): string; |
# @quilted/react-testing | ||
## 0.0.0-preview-20230318161322 | ||
## 0.0.0-preview-20230401011453 | ||
### Patch Changes | ||
- Upgrade Preact dependency | ||
- Update to TypeScript 5.0 | ||
- Faster descendants API for react-testing | ||
## 0.5.28 | ||
### Patch Changes | ||
- [#536](https://github.com/lemonmade/quilt/pull/536) [`cf6e2de1`](https://github.com/lemonmade/quilt/commit/cf6e2de186d8644fad9afcedda85c05002e909e1) Thanks [@lemonmade](https://github.com/lemonmade)! - Update to TypeScript 5.0 | ||
## 0.5.27 | ||
@@ -12,0 +16,0 @@ |
{ | ||
"name": "@quilted/react-testing", | ||
"type": "module", | ||
"version": "0.0.0-preview-20230318161322", | ||
"version": "0.0.0-preview-20230401011453", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -118,3 +118,3 @@ # `@quilted/react-testing` | ||
import {render} from '@quilted/react-testing'; | ||
import ClickCounter from './ClickCounter'; | ||
import ClickCounter from './ClickCounter.tsx'; | ||
@@ -148,4 +148,4 @@ describe('<ClickCounter />', () => { | ||
import {render} from '@quilted/react-testing'; | ||
import ClickCounter from './ClickCounter'; | ||
import LinkComponent from './LinkComponent'; | ||
import ClickCounter from './ClickCounter.tsx'; | ||
import LinkComponent from './LinkComponent.tsx'; | ||
@@ -152,0 +152,0 @@ describe('<ClickCounter />', () => { |
@@ -6,3 +6,3 @@ import {h, render as renderPreact, options} from 'preact'; | ||
import {createEnvironment, isNode} from '../environment'; | ||
import {createEnvironment, isNode} from '../environment.tsx'; | ||
import type { | ||
@@ -19,4 +19,10 @@ CustomRender, | ||
ActionsOption, | ||
} from '../environment'; | ||
import type {Node, NodeApi, Root, RootApi, HtmlNodeExtensions} from '../types'; | ||
} from '../environment.tsx'; | ||
import type { | ||
Node, | ||
NodeApi, | ||
Root, | ||
RootApi, | ||
HtmlNodeExtensions, | ||
} from '../types.ts'; | ||
@@ -23,0 +29,0 @@ interface Context { |
import {createRoot, type Root as ReactDomRoot} from 'react-dom/client'; | ||
import {act} from 'react-dom/test-utils'; | ||
import {createEnvironment, isNode} from '../environment'; | ||
import {createEnvironment, isNode} from '../environment.tsx'; | ||
import type { | ||
@@ -16,7 +16,16 @@ CustomRender, | ||
ActionsOption, | ||
} from '../environment'; | ||
import type {Node, NodeApi, Root, RootApi, HtmlNodeExtensions} from '../types'; | ||
} from '../environment.tsx'; | ||
import type { | ||
Node, | ||
NodeApi, | ||
Root, | ||
RootApi, | ||
HtmlNodeExtensions, | ||
} from '../types.ts'; | ||
import {Tag, findCurrentFiberUsingSlowPath} from './shared/react'; | ||
import type {Fiber} from './shared/react'; | ||
import { | ||
Tag, | ||
findCurrentFiberUsingSlowPath, | ||
type Fiber, | ||
} from './shared/react.ts'; | ||
@@ -23,0 +32,0 @@ interface Context { |
@@ -8,3 +8,3 @@ import { | ||
import {createEnvironment} from '../environment'; | ||
import {createEnvironment} from '../environment.tsx'; | ||
import type { | ||
@@ -21,3 +21,3 @@ CustomRender, | ||
ActionsOption, | ||
} from '../environment'; | ||
} from '../environment.tsx'; | ||
@@ -24,0 +24,0 @@ export type { |
// @see https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#configuring-your-testing-environment | ||
Reflect.defineProperty(globalThis, 'IS_REACT_ACT_ENVIRONMENT', {value: true}); | ||
export * from './implementations/test-renderer'; | ||
export * from './types'; | ||
export {createEnvironment} from './environment'; | ||
export * from './implementations/test-renderer.ts'; | ||
export * from './types.ts'; | ||
export {createEnvironment} from './environment.tsx'; | ||
export type { | ||
@@ -18,2 +18,2 @@ CustomRender, | ||
ActionsOption, | ||
} from './environment'; | ||
} from './environment.tsx'; |
@@ -10,3 +10,3 @@ import type {ComponentType} from 'react'; | ||
import {Node, PropsFor} from '../types'; | ||
import {Node, PropsFor} from '../types.ts'; | ||
@@ -19,3 +19,3 @@ import { | ||
printType, | ||
} from './utilities'; | ||
} from './utilities.ts'; | ||
@@ -22,0 +22,0 @@ export function toContainReactComponent< |
@@ -10,5 +10,5 @@ import {Context} from 'react'; | ||
import {Node} from '../types'; | ||
import type {Node} from '../types.ts'; | ||
import {assertIsNode, diffs, printType} from './utilities'; | ||
import {assertIsNode, diffs, printType} from './utilities.ts'; | ||
@@ -15,0 +15,0 @@ export function toProvideReactContext<Type>( |
@@ -11,6 +11,6 @@ import type {MatcherState} from 'expect'; | ||
import type {Node, HtmlNodeExtensions} from '../types'; | ||
import type {Node, HtmlNodeExtensions} from '../types.ts'; | ||
import {toHaveReactProps} from './props'; | ||
import {assertIsNode, printReceivedWithHighlight} from './utilities'; | ||
import {toHaveReactProps} from './props.ts'; | ||
import {assertIsNode, printReceivedWithHighlight} from './utilities.ts'; | ||
@@ -17,0 +17,0 @@ declare global { |
import type {ComponentType, Context as ReactContext} from 'react'; | ||
import type {Node, PropsFor} from '../types'; | ||
import type {Node, PropsFor} from '../types.ts'; | ||
import {toHaveReactProps} from './props'; | ||
import {toHaveReactProps} from './props.ts'; | ||
import { | ||
toContainReactComponent, | ||
toContainReactComponentTimes, | ||
} from './components'; | ||
import {toContainReactText} from './text'; | ||
import {toProvideReactContext} from './context'; | ||
} from './components.ts'; | ||
import {toContainReactText} from './text.ts'; | ||
import {toProvideReactContext} from './context.ts'; | ||
@@ -13,0 +13,0 @@ import {expect} from '@jest/globals'; |
@@ -9,5 +9,5 @@ import type {MatcherState} from 'expect'; | ||
import type {Node} from '../types'; | ||
import type {Node} from '../types.ts'; | ||
import {assertIsNode, diffPropsForNode} from './utilities'; | ||
import {assertIsNode, diffPropsForNode} from './utilities.ts'; | ||
@@ -14,0 +14,0 @@ export function toHaveReactProps<Props>( |
@@ -9,5 +9,5 @@ import type {MatcherState} from 'expect'; | ||
import type {Node} from '../types'; | ||
import type {Node} from '../types.ts'; | ||
import {assertIsNode, printReceivedWithHighlight} from './utilities'; | ||
import {assertIsNode, printReceivedWithHighlight} from './utilities.ts'; | ||
@@ -14,0 +14,0 @@ export function toContainReactText<Props>( |
@@ -13,4 +13,4 @@ import type {ComponentType} from 'react'; | ||
import type {Node} from '../types'; | ||
import {isNode} from '../environment'; | ||
import type {Node} from '../types.ts'; | ||
import {isNode} from '../environment.tsx'; | ||
@@ -17,0 +17,0 @@ export function assertIsNode( |
import {stringify} from 'jest-matcher-utils'; | ||
import type {DebugOptions, Node} from './types'; | ||
import type {DebugOptions, Node} from './types.ts'; | ||
@@ -5,0 +5,0 @@ const HIDE_NODE_CHILDREN = ['svg']; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
345643
5300