Skip to content

Commit e67ec2b

Browse files
authored
test: resolver cases (#1196)
1 parent 768e36f commit e67ec2b

15 files changed

Lines changed: 623 additions & 50 deletions

apps/tester-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"tailwindcss": "^3.4.17",
5858
"terser-webpack-plugin": "catalog:",
5959
"typescript": "catalog:",
60-
"vitest": "^2.0.5",
60+
"vitest": "catalog:",
6161
"webpack": "catalog:"
6262
}
6363
}

pnpm-lock.yaml

Lines changed: 99 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ catalog:
1414
"webpack": ^5.99.5
1515
"react": "19.0.0"
1616
"react-native": "0.79.1"
17+
"vitest": ^2.0.5
1718

1819
catalogs:
1920
testers:

tests/resolver-cases/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# resolver-cases-test
2+
3+
## Description
4+
5+
`resolver-cases-test` is a package that tests Repack's module resolution logic using `enhanced-resolve`. It validates various edge cases and scenarios from the React Native ecosystem using JSON fixtures to define package structures.
6+
7+
## Fixture-Based Approach
8+
9+
Tests use JSON fixtures in `src/__fixtures__/` to define package structures:
10+
11+
```json
12+
{
13+
"package.json": {
14+
"name": "my-package",
15+
"exports": {
16+
".": {
17+
"react-native": "./native.js",
18+
"default": "./web.js"
19+
}
20+
}
21+
},
22+
"files": ["native.js", "web.js"]
23+
}
24+
```
25+
26+
## Usage
27+
28+
```ts
29+
import { setupTestEnvironment } from "../test-helpers.js";
30+
31+
const { resolve } = await setupTestEnvironment(["platforms"], {
32+
platform: "ios",
33+
enablePackageExports: true,
34+
});
35+
36+
const result = await resolve("platform-specific-lib");
37+
expect(result).toBe("/node_modules/platform-specific-lib/index.ios.js");
38+
```

0 commit comments

Comments
 (0)