# @lynx-js/testing-environment

## 0.3.4

### Patch Changes

- Reach lynx-core's app object through `lynx.getApp()` instead of the ([#3553](https://github.com/lynx-family/lynx-stack/pull/3553))
  `lynxCoreInject` global the AMD wrapper injects. It is the same instance, so
  behavior is unchanged, and resolving it through `lynx` also stays correct once
  several cards share a runtime chunk. `@lynx-js/testing-environment` now exposes
  `lynx.getApp()` alongside the object it already provided.
- Move runtime attribute-name configuration to the page-scoped `lynx` object and ([#3718](https://github.com/lynx-family/lynx-stack/pull/3718))
  inject it from the host compilation through a standalone webpack plugin. Lazy
  and external bundles reuse the host-injected configuration without applying
  the plugin themselves. The runtime-config webpack plugin is published through
  its own DSL-neutral package entry and accepts arbitrary runtime configuration
  keys without depending on ReactLynx. The merged top-level configuration is
  shallow-frozen to prevent accidental mutation after host initialization.

## 0.3.3

### Patch Changes

- Support the `__GetAttributeNames` element PAPI. ([#3291](https://github.com/lynx-family/lynx-stack/pull/3291))

  `ElementNode.getAttributeNames()` of the ReactLynx worklet runtime calls it, so a
  main-thread script reaching that API threw `ReferenceError` on web.

## 0.3.2

### Patch Changes

- Model the engine's real `ContextProxy` routing: each thread now owns its own `getCoreContext()`/`getJSContext()` proxy pair, and an event whose target equals the dispatching proxy's origin is delivered locally instead of crossing threads (matching `context_proxy.cc`). Previously both contexts shared one event bus, so wrong-direction dispatches (e.g. `lynx.getCoreContext().dispatchEvent(...)` from the main thread) still reached the other thread in tests while silently failing on real devices. ([#3351](https://github.com/lynx-family/lynx-stack/pull/3351))

## 0.3.1

### Patch Changes

- Support the `__GetComputedStyleByKey` element PAPI. ([#3262](https://github.com/lynx-family/lynx-stack/pull/3262))

## 0.3.0

### Minor Changes

- Export `GlobalEventEmitter` as a public API and document the setup hooks (`onInjectBackgroundThreadGlobals`, `onInjectMainThreadGlobals`, `onSwitchedToBackgroundThread`, `onSwitchedToMainThread`, `onResetLynxTestingEnv`, `onInitWorkletRuntime`) to make `@lynx-js/testing-environment` a documented, first-class foundation for building framework-specific testing libraries. ([#2564](https://github.com/lynx-family/lynx-stack/pull/2564))

## 0.2.1

### Patch Changes

- Report error when `__RemoveElement` called on wrong parent and child. ([#2664](https://github.com/lynx-family/lynx-stack/pull/2664))

## 0.2.0

### Minor Changes

- **BREAKING CHANGE**: ([#2328](https://github.com/lynx-family/lynx-stack/pull/2328))

  Align the public test-environment API around `LynxEnv`.

  `LynxTestingEnv` now expects a `{ window }`-shaped environment instead of relying on a concrete `JSDOM` instance or `global.jsdom`. Callers that construct `LynxTestingEnv` manually or initialize the environment through globals should migrate to `new LynxTestingEnv({ window })` or set `global.lynxEnv`.

  This release also adds the `@lynx-js/testing-environment/env/rstest` entry for running the shared testing-environment suite under rstest.

### Patch Changes

- Add `__RemoveGestureDetector` PAPI binding ([#2297](https://github.com/lynx-family/lynx-stack/pull/2297))

## 0.1.12

### Patch Changes

- Implement `__ElementAnimate` PAPI for web platform animation lifecycle ([#2329](https://github.com/lynx-family/lynx-stack/pull/2329))

## 0.1.11

### Patch Changes

- Remove element api calls alog by default, and only enable it when `__ALOG_ELEMENT_API__` is defined to `true` or environment variable `REACT_ALOG_ELEMENT_API` is set to `true`. ([#2192](https://github.com/lynx-family/lynx-stack/pull/2192))

## 0.1.10

### Patch Changes

- Fix the error "lynxTestingEnv is not defined" ([#2118](https://github.com/lynx-family/lynx-stack/pull/2118))

## 0.1.9

### Patch Changes

- Fix duplicated `<page />` elements on body when multiple `__CreatePage` called. ([#2065](https://github.com/lynx-family/lynx-stack/pull/2065))

## 0.1.8

### Patch Changes

- Fix the "ReferenceError: Node is not defined" error. ([#1850](https://github.com/lynx-family/lynx-stack/pull/1850))

  This error would happen when upgrading to `@testing-library/jest-dom` [v6.9.0](https://github.com/testing-library/jest-dom/releases/tag/v6.9.0).

## 0.1.7

### Patch Changes

- Support `lynx.createSelectorQuery().select()` and `setNativeProps` API ([#1570](https://github.com/lynx-family/lynx-stack/pull/1570))

## 0.1.6

### Patch Changes

- Fix that `lynxTestingEnv.jsdom` cannot be initialized correctly when `global.jsdom` is not defined. ([#1422](https://github.com/lynx-family/lynx-stack/pull/1422))

## 0.1.5

### Patch Changes

- Fix `GlobalEventEmitter` type definition, the `emit(eventName: string, data: unknown)` function should recevie an array typed `data` and pass as param list of listeners. ([#1479](https://github.com/lynx-family/lynx-stack/pull/1479))

## 0.1.4

### Patch Changes

- Fix the thread switching bug in `lynx.getCoreContext` and `lynx.getJSContext`. ([#1244](https://github.com/lynx-family/lynx-stack/pull/1244))

## 0.1.3

### Patch Changes

- Support alog of component rendering on production for better error reporting. Enable it by using `REACT_ALOG=true rspeedy dev/build` or defining `__ALOG__` to `true` in `lynx.config.js`: ([#1164](https://github.com/lynx-family/lynx-stack/pull/1164))

  ```js
  export default defineConfig({
    // ...
    source: {
      define: {
        __ALOG__: true,
      },
    },
  });
  ```

- Supports `console.alog` and use different `console` object in main thread and background thread. ([#1164](https://github.com/lynx-family/lynx-stack/pull/1164))

## 0.1.2

### Patch Changes

- Fix the infinite loop in the `__RemoveElement` element PAPI. ([#1263](https://github.com/lynx-family/lynx-stack/pull/1263))

## 0.1.1

### Patch Changes

- Fix `getJSContext` or `getCoreContext` is not a function. ([#1122](https://github.com/lynx-family/lynx-stack/pull/1122))

## 0.1.0

### Minor Changes

- Switch to ESM package format by setting `"type": "module"`. ([#703](https://github.com/lynx-family/lynx-stack/pull/703))

### Patch Changes

- rename @lynx-js/test-environment to @lynx-js/testing-environment ([#704](https://github.com/lynx-family/lynx-stack/pull/704))

## 0.0.1

### Patch Changes

- Add testing library for ReactLynx ([#74](https://github.com/lynx-family/lynx-stack/pull/74))
