EXPO_PUBLIC_ client env vars & TS alias in jest, expo 49.0.0-beta.0

Please provide the following:

  1. SDK Version: ^49.0.0-beta.0
  2. Platforms(Android/iOS/web/all): all

Ive noticed that EXPO_PUBLIC_ client env vars & TS aliases don’t currently work in jest. You can easily enable this by adding the following to your project.

// ./jest.setup.ts
import * as env from "@expo/env";
import path from "path";

env.load(path.resolve(__dirname));
import type { Config } from "jest";

const config: Config = {
  preset: "jest-expo",
  moduleNameMapper: {
    "@lib/(.*)": "<rootDir>/src/lib/$1",
    "@ui/(.*)": "<rootDir>/src/ui/$1",
  },
  setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
};

Replace this section with as much relevant information as possible and any relevant code along with your question.

Thanks, @ben2hellandback

It would be great if you can create an issue here with these details:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.