@codyswann/lisa 1.22.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,8 @@ Always use project-relative paths rather than absolute paths in documentation an
16
16
  Always ignore build folders (dist, build, etc) unless specified otherwise
17
17
  Always delete and remove old code completely - no deprecation needed
18
18
  Always add `GIT_SSH_COMMAND="ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=5" ` when running `git push`
19
- Always err on the side of creating a plan before directly executing a coding task
19
+ Always ignore knip configuration hints (warnings) only fix actual unused exports/dependencies reported as errors
20
+ Always err on the side of creating a plan before directly executing a coding task
20
21
 
21
22
  Never modify this file (CLAUDE.md) directly. To add a memory or learning, add it to .claude/rules/PROJECT_RULES.md or create a skill with /skill-creator.
22
23
  Never commit changes to an environment branch (dev, staging, main) directly. This is enforced by the pre-commit hook.
@@ -108,7 +108,7 @@ The Zod pattern validates `process.env` directly - it doesn't care how variables
108
108
 
109
109
  ## Testing Pattern
110
110
 
111
- ### Jest Setup (`jest.setup.ts`)
111
+ ### Jest Setup (`jest.setup.local.ts`)
112
112
 
113
113
  ```typescript
114
114
  // Mock the env module for all tests
@@ -304,6 +304,6 @@ When adding or modifying environment variables:
304
304
  - [ ] Variable is added to the Zod schema in `src/lib/env.ts`
305
305
  - [ ] Appropriate Zod type/transform is used (url, enum, boolean transform, etc.)
306
306
  - [ ] Default value provided for optional variables
307
- - [ ] Jest mock updated in `jest.setup.ts`
307
+ - [ ] Jest mock updated in `jest.setup.local.ts`
308
308
  - [ ] Variable documented in `.env.example` or `.env.development`
309
309
  - [ ] Sensitive values use EAS Secrets, not `.env` files
@@ -241,7 +241,7 @@ export const env = parseEnv();
241
241
  ### Complete Mock Setup
242
242
 
243
243
  ```typescript
244
- // jest.setup.ts
244
+ // jest.setup.local.ts
245
245
  const mockEnv = {
246
246
  EXPO_PUBLIC_API_URL: "https://test.example.com",
247
247
  EXPO_PUBLIC_APP_ENV: "development" as const,
@@ -15,12 +15,11 @@
15
15
  * Instead, this config manually replicates the preset's resolution,
16
16
  * transform, and haste settings without any preset setupFiles.
17
17
  *
18
- * `setupFiles` is intentionally empty because `jest-expo/src/preset/setup.js`
19
- * requires `__DEV__` to be defined before it runs, and `mergeConfigs`
20
- * concatenates arrays with base entries first making it impossible for
21
- * project-local setupFiles to prepend a `__DEV__` definition. Projects
22
- * should add their own setupFiles in `jest.config.local.ts` with the
23
- * correct ordering (define globals first, then load jest-expo setup).
18
+ * `setupFiles` and `setupFilesAfterEnv` are configured here to wire up
19
+ * the base jest setup files (`jest.setup.pre.js` and `jest.setup.ts`).
20
+ * These base files import project-local overrides (`jest.setup.pre.local.js`
21
+ * and `jest.setup.local.ts`) which are create-only templates that projects
22
+ * can customize without Lisa overwriting them.
24
23
  *
25
24
  * Coverage collection is scoped to standard Expo source directories
26
25
  * rather than a catch-all glob, preventing config files, scripts, and
@@ -67,9 +66,7 @@ interface ExpoJestOptions {
67
66
  * @returns Jest config object with jsdom environment, babel-jest transform, and React Native resolver
68
67
  * @remarks Avoids `jest-expo` preset to prevent jsdom + `react-native/jest/setup.js`
69
68
  * incompatibility. Manually configures haste, resolver, and transform to match the
70
- * preset's behavior without the problematic window redefinition. `setupFiles` is
71
- * empty — projects must provide their own in `jest.config.local.ts` with correct
72
- * ordering (define `__DEV__` before loading `jest-expo/src/preset/setup.js`).
69
+ * preset's behavior without the problematic window redefinition.
73
70
  */
74
71
  export const getExpoJestConfig = ({
75
72
  thresholds = defaultThresholds,
@@ -80,7 +77,8 @@ export const getExpoJestConfig = ({
80
77
  platforms: ["android", "ios", "native"],
81
78
  },
82
79
  resolver: "react-native/jest/resolver.js",
83
- setupFiles: [],
80
+ setupFiles: ["<rootDir>/jest.setup.pre.js"],
81
+ setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
84
82
  transform: {
85
83
  "\\.[jt]sx?$": [
86
84
  "babel-jest",
@@ -114,7 +112,6 @@ export const getExpoJestConfig = ({
114
112
  "stores/**/*.{ts,tsx}",
115
113
  "types/**/*.{ts,tsx}",
116
114
  "utils/**/*.{ts,tsx}",
117
- "!**/*.d.ts",
118
115
  ...defaultCoverageExclusions,
119
116
  ],
120
117
  coverageThreshold: thresholds,
@@ -1,10 +1,18 @@
1
1
  /**
2
- * Jest Pre-Setup File
2
+ * This file is managed by Lisa.
3
+ * Do not edit directly — changes will be overwritten on the next `lisa` run.
4
+ */
5
+
6
+ /**
7
+ * Jest Pre-Setup File - Base Configuration
3
8
  *
4
9
  * Runs before Jest loads any other modules to set up global flags needed
5
10
  * by React Native. This file must be JavaScript (not TypeScript) and must
6
11
  * not import any modules that depend on the global flags being set.
7
12
  *
13
+ * Project-specific pre-framework globals belong in `jest.setup.pre.local.js`
14
+ * (create-only).
15
+ *
8
16
  * @remarks
9
17
  * - Listed in `setupFiles` (runs before test framework loads)
10
18
  * - Sets `__DEV__`, `IS_REACT_ACT_ENVIRONMENT`, and other RN globals
@@ -104,3 +112,6 @@ global.window = {
104
112
  removeListener: jest.fn(),
105
113
  })),
106
114
  };
115
+
116
+ // Project-local pre-framework globals (create-only — Lisa never overwrites this)
117
+ require("./jest.setup.pre.local");
@@ -1,10 +1,17 @@
1
1
  /**
2
- * Jest Setup File
2
+ * This file is managed by Lisa.
3
+ * Do not edit directly — changes will be overwritten on the next `lisa` run.
4
+ */
5
+
6
+ /**
7
+ * Jest Setup File - Base Configuration
3
8
  *
4
9
  * Configures the testing environment after Jest loads modules.
5
10
  * Sets up React Native Testing Library matchers, global mocks,
6
11
  * and manual cleanup for React 19 compatibility.
7
12
  *
13
+ * Project-specific mocks belong in `jest.setup.local.ts` (create-only).
14
+ *
8
15
  * @remarks
9
16
  * - Listed in `setupFilesAfterEnv` (runs after test framework loads)
10
17
  * - Basic globals like `__DEV__` are set earlier in `jest.setup.pre.js`
@@ -16,21 +23,14 @@
16
23
  * @module jest.setup
17
24
  */
18
25
 
26
+ // Project-local mocks and setup (create-only — Lisa never overwrites this)
27
+ import "./jest.setup.local";
28
+
19
29
  // Import from pure to avoid auto-cleanup (we set RNTL_SKIP_AUTO_CLEANUP in pre-setup)
20
30
  // Then extend Jest matchers with React Native Testing Library matchers
21
31
  import { cleanup } from "@testing-library/react-native/pure";
22
32
  import "@testing-library/react-native/build/matchers/extend-expect";
23
33
 
24
- // Mock environment variables module for type-safe env access in tests
25
- // Tests can override specific values via jest.spyOn or jest.doMock
26
- // Replace the mock below with your project's actual env module and values
27
- jest.mock("@/lib/env", () => ({
28
- env: {
29
- EXPO_PUBLIC_ENV: "dev",
30
- // Add your project-specific environment variables here
31
- },
32
- }));
33
-
34
34
  // Extend global type for the unhandledRejection handler set in jest.setup.pre.js
35
35
  declare global {
36
36
  let __unhandledRejectionHandler:
@@ -38,8 +38,8 @@ declare global {
38
38
  | undefined;
39
39
  }
40
40
 
41
- // Manual cleanup after each test (replacing RTLRN's auto cleanup)
42
- // This handles React 19's cleanup which can throw null
41
+ // Manual cleanup and mock reset after each test
42
+ // Replaces RTLRN's auto cleanup to handle React 19's null-throw during teardown
43
43
  afterEach(async () => {
44
44
  try {
45
45
  await cleanup();
@@ -49,6 +49,7 @@ afterEach(async () => {
49
49
  throw error;
50
50
  }
51
51
  }
52
+ jest.clearAllMocks();
52
53
  });
53
54
 
54
55
  // Mock ResizeObserver for tests that use it
@@ -90,25 +91,6 @@ jest.mock("expo-router", () => ({
90
91
  },
91
92
  }));
92
93
 
93
- // Mock @react-native-firebase/analytics
94
- jest.mock("@react-native-firebase/analytics", () => {
95
- const logEvent = jest.fn();
96
- const getAnalytics = jest.fn(() => ({}));
97
- return { logEvent, getAnalytics };
98
- });
99
-
100
- // Mock firebase/analytics
101
- jest.mock("firebase/analytics", () => {
102
- const logEvent = jest.fn();
103
- const getAnalytics = jest.fn(() => ({}));
104
- return { logEvent, getAnalytics };
105
- });
106
-
107
- // Clear mocks after each test
108
- afterEach(() => {
109
- jest.clearAllMocks();
110
- });
111
-
112
94
  // Remove the unhandledRejection handler after all tests to allow Jest to exit cleanly
113
95
  // The handler is registered in jest.setup.pre.js and stored on global
114
96
  afterAll(() => {
@@ -14,5 +14,5 @@
14
14
  "moduleSuffixes": [".ios", ".android", ".native", ".web", ""]
15
15
  },
16
16
  "include": ["**/*.ts", "**/*.tsx", "nativewind-env.d.ts"],
17
- "exclude": ["node_modules", "dist", "web-build"]
17
+ "exclude": ["node_modules", "dist", "web-build", "components/ui"]
18
18
  }
@@ -5,20 +5,15 @@
5
5
  * meaning Lisa will create it but never overwrite your customizations.
6
6
  *
7
7
  * The Expo stack's `jest.expo.ts` provides haste, resolver, transform,
8
- * and base coverage settings. This file should only contain settings
9
- * that are project-specific or need to override the base config.
8
+ * setupFiles, and base coverage settings. This file should only contain
9
+ * settings that are project-specific or need to override the base config.
10
10
  *
11
- * @remarks `setupFiles` must define `__DEV__` and other React Native
12
- * globals before any RN modules load — `jest.setup.pre.js` handles this.
13
11
  * @see https://jestjs.io/docs/configuration
14
12
  * @module jest.config.local
15
13
  */
16
14
  import type { Config } from "jest";
17
15
 
18
16
  const config: Config = {
19
- setupFiles: ["<rootDir>/jest.setup.pre.js"],
20
- setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
21
-
22
17
  // Path aliases matching tsconfig.expo.json paths
23
18
  moduleNameMapper: {
24
19
  "^@/(.*)$": "<rootDir>/$1",
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Jest Setup - Project-Local Customizations
3
+ *
4
+ * Add project-specific jest.mock() calls, afterEach hooks, and other
5
+ * test setup here. This file is create-only — Lisa will never overwrite it.
6
+ *
7
+ * Common additions:
8
+ * - jest.mock("@/lib/env", ...) for environment variable mocking
9
+ * - jest.mock("@sentry/react-native", ...) for Sentry
10
+ * - jest.mock("nativewind", ...) for NativeWind/styling
11
+ * - jest.mock("react-native-reanimated", ...) for animations
12
+ * - Additional expo-* module mocks specific to your dependencies
13
+ */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Jest Pre-Setup - Project-Local Customizations
3
+ *
4
+ * Add project-specific pre-framework globals here. This file runs before
5
+ * Jest loads any test modules. This file is create-only — Lisa will never
6
+ * overwrite it.
7
+ *
8
+ * Common additions:
9
+ * - Additional global polyfills (setImmediate, ErrorUtils, Web Streams)
10
+ * - Expo-specific polyfills (expo-modules-core global polyfill)
11
+ * - Custom __ExpoImportMetaRegistry setup
12
+ */
package/package.json CHANGED
@@ -88,7 +88,7 @@
88
88
  "@isaacs/brace-expansion": "^5.0.1"
89
89
  },
90
90
  "name": "@codyswann/lisa",
91
- "version": "1.22.0",
91
+ "version": "1.23.0",
92
92
  "description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
93
93
  "main": "dist/index.js",
94
94
  "bin": {