test(app): load the image decoder in unit tests

This commit is contained in:
paseo-bot[bot]
2026-11-09 20:53:53 +00:00
parent f38c3d7059
commit 917c72d279
2 changed files with 23 additions and 0 deletions
+6
View File
@@ -14,6 +14,12 @@ const tsgoEntry = path.join(
"bin/tsgo.js",
);
it("the test environment loads Expo Image", async () => {
const { Image } = await import("expo-image");
expect(Image).toEqual(expect.any(Function));
});
it("the test configuration typechecks with Expo's generated environment declaration", () => {
const fixtureDir = mkdtempSync(path.join(appDir, ".vitest-expo-env-"));
try {
+17
View File
@@ -19,6 +19,23 @@ const resolvePackageEntry = (packageName: string) => {
export default defineConfig({
plugins: [
{
name: "bundle-expo-runtime",
// Expo initializes import.meta through a literal require of TypeScript.
// Bundle that boundary so Node need not resolve Metro's extensionless require.
async transform(_source, id) {
if (!id.endsWith("/expo/src/winter/runtime.ts")) return;
const result = await build({
entryPoints: [id],
bundle: true,
format: "esm",
platform: "neutral",
define: { __DEV__: "false" },
write: false,
});
return { code: result.outputFiles[0].text, map: null };
},
},
{
name: "markdown-wasm-commonjs-export",
transform(source, id) {