Skip to content

Commit 100a51e

Browse files
committed
split out yarnpnp snapshot tests
1 parent 13aace3 commit 100a51e

File tree

4 files changed

+162
-153
lines changed

4 files changed

+162
-153
lines changed

internal/bundler_tests/bundler_tsconfig_test.go

Lines changed: 0 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,79 +2582,6 @@ func TestTsconfigJsonAsteriskNameCollisionIssue3354(t *testing.T) {
25822582
})
25832583
}
25842584

2585-
// https://github.com/evanw/esbuild/issues/3698
2586-
func TestTsconfigPackageJsonExportsYarnPnP(t *testing.T) {
2587-
tsconfig_suite.expectBundled(t, bundled{
2588-
files: map[string]string{
2589-
"/Users/user/project/packages/app/index.tsx": `
2590-
console.log(<div/>)
2591-
`,
2592-
"/Users/user/project/packages/app/tsconfig.json": `
2593-
{
2594-
"extends": "tsconfigs/config"
2595-
}
2596-
`,
2597-
"/Users/user/project/packages/tsconfigs/package.json": `
2598-
{
2599-
"exports": {
2600-
"./config": "./configs/tsconfig.json"
2601-
}
2602-
}
2603-
`,
2604-
"/Users/user/project/packages/tsconfigs/configs/tsconfig.json": `
2605-
{
2606-
"compilerOptions": {
2607-
"jsxFactory": "success"
2608-
}
2609-
}
2610-
`,
2611-
"/Users/user/project/.pnp.data.json": `
2612-
{
2613-
"packageRegistryData": [
2614-
[
2615-
"app",
2616-
[
2617-
[
2618-
"workspace:packages/app",
2619-
{
2620-
"packageLocation": "./packages/app/",
2621-
"packageDependencies": [
2622-
[
2623-
"tsconfigs",
2624-
"workspace:packages/tsconfigs"
2625-
]
2626-
],
2627-
"linkType": "SOFT"
2628-
}
2629-
]
2630-
]
2631-
],
2632-
[
2633-
"tsconfigs",
2634-
[
2635-
[
2636-
"workspace:packages/tsconfigs",
2637-
{
2638-
"packageLocation": "./packages/tsconfigs/",
2639-
"packageDependencies": [],
2640-
"linkType": "SOFT"
2641-
}
2642-
]
2643-
]
2644-
]
2645-
]
2646-
}
2647-
`,
2648-
},
2649-
entryPaths: []string{"/Users/user/project/packages/app/index.tsx"},
2650-
absWorkingDir: "/Users/user/project",
2651-
options: config.Options{
2652-
Mode: config.ModeBundle,
2653-
AbsOutputFile: "/Users/user/project/out.js",
2654-
},
2655-
})
2656-
}
2657-
26582585
func TestTsconfigJsonConfigDirBaseURL(t *testing.T) {
26592586
tsconfig_suite.expectBundled(t, bundled{
26602587
files: map[string]string{
@@ -2750,74 +2677,6 @@ func TestTsconfigJsonConfigDirBaseURLInheritedPaths(t *testing.T) {
27502677
})
27512678
}
27522679

2753-
// https://github.com/evanw/esbuild/issues/3915
2754-
func TestTsconfigStackOverflowYarnPnP(t *testing.T) {
2755-
tsconfig_suite.expectBundled(t, bundled{
2756-
files: map[string]string{
2757-
"/Users/user/project/entry.jsx": `
2758-
console.log(<div />)
2759-
`,
2760-
"/Users/user/project/tsconfig.json": `
2761-
{
2762-
"extends": "tsconfigs/config"
2763-
}
2764-
`,
2765-
"/Users/user/project/packages/tsconfigs/package.json": `
2766-
{
2767-
"exports": {
2768-
"./config": "./configs/tsconfig.json"
2769-
}
2770-
}
2771-
`,
2772-
"/Users/user/project/packages/tsconfigs/configs/tsconfig.json": `
2773-
{
2774-
"compilerOptions": {
2775-
"jsxFactory": "success"
2776-
}
2777-
}
2778-
`,
2779-
"/Users/user/project/.pnp.data.json": `
2780-
{
2781-
"packageRegistryData": [
2782-
[null, [
2783-
[null, {
2784-
"packageLocation": "./",
2785-
"packageDependencies": [
2786-
["tsconfigs", "virtual:some-path"]
2787-
],
2788-
"linkType": "SOFT"
2789-
}]
2790-
]],
2791-
["tsconfigs", [
2792-
["virtual:some-path", {
2793-
"packageLocation": "./packages/tsconfigs/",
2794-
"packageDependencies": [
2795-
["tsconfigs", "virtual:some-path"]
2796-
],
2797-
"packagePeers": [],
2798-
"linkType": "SOFT"
2799-
}],
2800-
["workspace:packages/tsconfigs", {
2801-
"packageLocation": "./packages/tsconfigs/",
2802-
"packageDependencies": [
2803-
["tsconfigs", "workspace:packages/tsconfigs"]
2804-
],
2805-
"linkType": "SOFT"
2806-
}]
2807-
]]
2808-
]
2809-
}
2810-
`,
2811-
},
2812-
entryPaths: []string{"/Users/user/project/entry.jsx"},
2813-
absWorkingDir: "/Users/user/project",
2814-
options: config.Options{
2815-
Mode: config.ModeBundle,
2816-
AbsOutputFile: "/Users/user/project/out.js",
2817-
},
2818-
})
2819-
}
2820-
28212680
func TestTsconfigJsonExtendsArrayIssue3898(t *testing.T) {
28222681
tsconfig_suite.expectBundled(t, bundled{
28232682
files: map[string]string{
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
package bundler_tests
2+
3+
import (
4+
"testing"
5+
6+
"github.com/evanw/esbuild/internal/config"
7+
)
8+
9+
var yarnpnp_suite = suite{
10+
name: "yarnpnp",
11+
}
12+
13+
// https://github.com/evanw/esbuild/issues/3698
14+
func TestTsconfigPackageJsonExportsYarnPnP(t *testing.T) {
15+
yarnpnp_suite.expectBundled(t, bundled{
16+
files: map[string]string{
17+
"/Users/user/project/packages/app/index.tsx": `
18+
console.log(<div/>)
19+
`,
20+
"/Users/user/project/packages/app/tsconfig.json": `
21+
{
22+
"extends": "tsconfigs/config"
23+
}
24+
`,
25+
"/Users/user/project/packages/tsconfigs/package.json": `
26+
{
27+
"exports": {
28+
"./config": "./configs/tsconfig.json"
29+
}
30+
}
31+
`,
32+
"/Users/user/project/packages/tsconfigs/configs/tsconfig.json": `
33+
{
34+
"compilerOptions": {
35+
"jsxFactory": "success"
36+
}
37+
}
38+
`,
39+
"/Users/user/project/.pnp.data.json": `
40+
{
41+
"packageRegistryData": [
42+
[
43+
"app",
44+
[
45+
[
46+
"workspace:packages/app",
47+
{
48+
"packageLocation": "./packages/app/",
49+
"packageDependencies": [
50+
[
51+
"tsconfigs",
52+
"workspace:packages/tsconfigs"
53+
]
54+
],
55+
"linkType": "SOFT"
56+
}
57+
]
58+
]
59+
],
60+
[
61+
"tsconfigs",
62+
[
63+
[
64+
"workspace:packages/tsconfigs",
65+
{
66+
"packageLocation": "./packages/tsconfigs/",
67+
"packageDependencies": [],
68+
"linkType": "SOFT"
69+
}
70+
]
71+
]
72+
]
73+
]
74+
}
75+
`,
76+
},
77+
entryPaths: []string{"/Users/user/project/packages/app/index.tsx"},
78+
absWorkingDir: "/Users/user/project",
79+
options: config.Options{
80+
Mode: config.ModeBundle,
81+
AbsOutputFile: "/Users/user/project/out.js",
82+
},
83+
})
84+
}
85+
86+
// https://github.com/evanw/esbuild/issues/3915
87+
func TestTsconfigStackOverflowYarnPnP(t *testing.T) {
88+
yarnpnp_suite.expectBundled(t, bundled{
89+
files: map[string]string{
90+
"/Users/user/project/entry.jsx": `
91+
console.log(<div />)
92+
`,
93+
"/Users/user/project/tsconfig.json": `
94+
{
95+
"extends": "tsconfigs/config"
96+
}
97+
`,
98+
"/Users/user/project/packages/tsconfigs/package.json": `
99+
{
100+
"exports": {
101+
"./config": "./configs/tsconfig.json"
102+
}
103+
}
104+
`,
105+
"/Users/user/project/packages/tsconfigs/configs/tsconfig.json": `
106+
{
107+
"compilerOptions": {
108+
"jsxFactory": "success"
109+
}
110+
}
111+
`,
112+
"/Users/user/project/.pnp.data.json": `
113+
{
114+
"packageRegistryData": [
115+
[null, [
116+
[null, {
117+
"packageLocation": "./",
118+
"packageDependencies": [
119+
["tsconfigs", "virtual:some-path"]
120+
],
121+
"linkType": "SOFT"
122+
}]
123+
]],
124+
["tsconfigs", [
125+
["virtual:some-path", {
126+
"packageLocation": "./packages/tsconfigs/",
127+
"packageDependencies": [
128+
["tsconfigs", "virtual:some-path"]
129+
],
130+
"packagePeers": [],
131+
"linkType": "SOFT"
132+
}],
133+
["workspace:packages/tsconfigs", {
134+
"packageLocation": "./packages/tsconfigs/",
135+
"packageDependencies": [
136+
["tsconfigs", "workspace:packages/tsconfigs"]
137+
],
138+
"linkType": "SOFT"
139+
}]
140+
]]
141+
]
142+
}
143+
`,
144+
},
145+
entryPaths: []string{"/Users/user/project/entry.jsx"},
146+
absWorkingDir: "/Users/user/project",
147+
options: config.Options{
148+
Mode: config.ModeBundle,
149+
AbsOutputFile: "/Users/user/project/out.js",
150+
},
151+
})
152+
}

internal/bundler_tests/snapshots/snapshots_tsconfig.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,6 @@ var both_default = /* @__PURE__ */ R.c(R.F, null, /* @__PURE__ */ R.c("div", nul
492492
// Users/user/project/entry.ts
493493
console.log(factory_default, fragment_default, both_default);
494494

495-
================================================================================
496-
TestTsconfigPackageJsonExportsYarnPnP
497-
---------- /Users/user/project/out.js ----------
498-
// packages/app/index.tsx
499-
console.log(/* @__PURE__ */ success("div", null));
500-
501495
================================================================================
502496
TestTsconfigPaths
503497
---------- /Users/user/project/out.js ----------
@@ -806,12 +800,6 @@ TestTsconfigRemoveUnusedImports
806800
// Users/user/project/src/entry.ts
807801
console.log(1);
808802

809-
================================================================================
810-
TestTsconfigStackOverflowYarnPnP
811-
---------- /Users/user/project/out.js ----------
812-
// entry.jsx
813-
console.log(/* @__PURE__ */ success("div", null));
814-
815803
================================================================================
816804
TestTsconfigUnrecognizedTargetWarning
817805
---------- /Users/user/project/out.js ----------
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
TestTsconfigPackageJsonExportsYarnPnP
2+
---------- /Users/user/project/out.js ----------
3+
// packages/app/index.tsx
4+
console.log(/* @__PURE__ */ success("div", null));
5+
6+
================================================================================
7+
TestTsconfigStackOverflowYarnPnP
8+
---------- /Users/user/project/out.js ----------
9+
// entry.jsx
10+
console.log(/* @__PURE__ */ success("div", null));

0 commit comments

Comments
 (0)