Skip to content

Commit 1375605

Browse files
committed
test: one test for one snapshot file
1 parent fbb6ada commit 1375605

File tree

11 files changed

+282
-234
lines changed

11 files changed

+282
-234
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"@swc/core": "^1.10.0",
112112
"@sxzz/eslint-config": "^4.5.1",
113113
"@sxzz/prettier-config": "^2.0.2",
114-
"@sxzz/test-utils": "^0.3.8",
114+
"@sxzz/test-utils": "^0.3.10",
115115
"@types/debug": "^4.1.12",
116116
"@types/node": "^22.10.1",
117117
"bumpp": "^9.9.0",

pnpm-lock.yaml

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

tests/__snapshots__/esbuild.test.ts.snap

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,3 @@ export type Num = Num2;
3737
export type Num2 = number;
3838
"
3939
`;
40-
41-
exports[`esbuild > write mode 1`] = `
42-
"// component.d.ts
43-
export declare function Component(): React.JSX.Element;
44-
//# sourceMappingURL=component.d.ts.map
45-
46-
// component.d.ts.map
47-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../fixtures/basic/component.tsx"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAE7C"}
48-
49-
// main.d.ts
50-
import { type Num } from './types';
51-
export type Str = string;
52-
export declare function hello(s: Str): Str;
53-
export declare let c: React.JSX.Element;
54-
export declare let num: Num;
55-
//# sourceMappingURL=main.d.ts.map
56-
57-
// main.d.ts.map
58-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../fixtures/basic/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,SAAS,CAAA;AAElC,MAAM,MAAM,GAAG,GAAG,MAAM,CAAA;AAExB,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,CAEjC;AAED,eAAO,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,OAAmB,CAAA;AAE3C,eAAO,IAAI,GAAG,EAAE,GAAO,CAAA"}
59-
60-
// types.d.ts
61-
import type { Num2 } from './types2';
62-
export type Num = Num2;
63-
//# sourceMappingURL=types.d.ts.map
64-
65-
// types.d.ts.map
66-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../fixtures/basic/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACpC,MAAM,MAAM,GAAG,GAAG,IAAI,CAAA"}
67-
68-
// types2.d.ts
69-
export type Num2 = number;
70-
//# sourceMappingURL=types2.d.ts.map
71-
72-
// types2.d.ts.map
73-
{"version":3,"file":"types2.d.ts","sourceRoot":"","sources":["../../../../fixtures/basic/types2.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,IAAI,GAAG,MAAM,CAAA"}"
74-
`;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## component.d.ts
2+
3+
```ts
4+
export declare function Component(): React.JSX.Element;
5+
//# sourceMappingURL=component.d.ts.map
6+
```
7+
## component.d.ts.map
8+
9+
```map
10+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../fixtures/basic/component.tsx"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAE7C"}
11+
```
12+
## main.d.ts
13+
14+
```ts
15+
import { type Num } from './types';
16+
export type Str = string;
17+
export declare function hello(s: Str): Str;
18+
export declare let c: React.JSX.Element;
19+
export declare let num: Num;
20+
//# sourceMappingURL=main.d.ts.map
21+
```
22+
## main.d.ts.map
23+
24+
```map
25+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../fixtures/basic/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,SAAS,CAAA;AAElC,MAAM,MAAM,GAAG,GAAG,MAAM,CAAA;AAExB,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,CAEjC;AAED,eAAO,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,OAAmB,CAAA;AAE3C,eAAO,IAAI,GAAG,EAAE,GAAO,CAAA"}
26+
```
27+
## types.d.ts
28+
29+
```ts
30+
import type { Num2 } from './types2';
31+
export type Num = Num2;
32+
//# sourceMappingURL=types.d.ts.map
33+
```
34+
## types.d.ts.map
35+
36+
```map
37+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../fixtures/basic/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACpC,MAAM,MAAM,GAAG,GAAG,IAAI,CAAA"}
38+
```
39+
## types2.d.ts
40+
41+
```ts
42+
export type Num2 = number;
43+
//# sourceMappingURL=types2.d.ts.map
44+
```
45+
## types2.d.ts.map
46+
47+
```map
48+
{"version":3,"file":"types2.d.ts","sourceRoot":"","sources":["../../../../fixtures/basic/types2.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,IAAI,GAAG,MAAM,CAAA"}
49+
```
Lines changed: 21 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`rollup > autoAddExts 1`] = `
3+
exports[`rollup > auto add exts 1`] = `
44
"// main.js
55
function Component() {
66
return /* @__PURE__ */ React.createElement("div", null, "I'm a div in a tsx component!");
@@ -45,6 +45,26 @@ export type Str = string;
4545
"
4646
`;
4747

48+
exports[`rollup > don't add exts, but keep 1`] = `
49+
"// main.d.ts
50+
export type {} from './types.js';
51+
export type {} from './types.js';
52+
export type {} from './tsx.js';
53+
export type {} from './tsx.jsx';
54+
export type {} from './tsx.js';
55+
export type {} from './tsx.jsx';
56+
57+
// main.js
58+
59+
60+
// tsx.d.ts
61+
export type A = string;
62+
63+
// types.d.ts
64+
export type Str = string;
65+
"
66+
`;
67+
4868
exports[`rollup > generate basic 1`] = `
4969
"// main.js
5070
function Component() {
@@ -77,156 +97,3 @@ export type Num = Num2;
7797
export type Num2 = number;
7898
"
7999
`;
80-
81-
exports[`rollup > no index path 1`] = `
82-
"// foo/index.d.ts
83-
export type Foo = string;
84-
85-
86-
// index.d.ts
87-
export type Bar = string;
88-
89-
90-
// main.d.ts
91-
export {} from './foo/index.js';
92-
export {} from './index.js';
93-
94-
95-
// main.js
96-
97-
"
98-
`;
99-
100-
exports[`rollup > with exts 1`] = `
101-
"// main.d.ts
102-
export type {} from './types.js';
103-
export type {} from './types.js';
104-
export type {} from './tsx.js';
105-
export type {} from './tsx.jsx';
106-
export type {} from './tsx.js';
107-
export type {} from './tsx.jsx';
108-
109-
// main.js
110-
111-
112-
// tsx.d.ts
113-
export type A = string;
114-
115-
// types.d.ts
116-
export type Str = string;
117-
"
118-
`;
119-
120-
exports[`rollup > write entry-points (#22) 1`] = `
121-
"// a/ComponentA/ComponentA/index.d.ts
122-
import React from 'react';
123-
export { a } from '../../Models/model/index.js';
124-
interface ComponentAProps {
125-
test: string;
126-
}
127-
export declare function ComponentA(props: ComponentAProps): React.JSX.Element;
128-
//# sourceMappingURL=index.d.ts.map
129-
130-
// a/ComponentA/ComponentA/index.d.ts.map
131-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../fixtures/entry-points-22/a/ComponentA/ComponentA.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAA;AAEnC,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAGpE"}
132-
133-
// a/ComponentA/ComponentA/index.js
134-
import React from 'react';
135-
136-
function ComponentA(props) {
137-
const { test } = props;
138-
return /* @__PURE__ */ React.createElement(React.Fragment, null, "ComponentA: ", test);
139-
}
140-
141-
export { ComponentA };
142-
143-
144-
// a/Models/model/index.d.ts
145-
export interface MyModel {
146-
some: string;
147-
}
148-
export declare const a = "b";
149-
//# sourceMappingURL=index.d.ts.map
150-
151-
// a/Models/model/index.d.ts.map
152-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../fixtures/entry-points-22/a/Models/model.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAA;CACb;AACD,eAAO,MAAM,CAAC,MAAM,CAAA"}
153-
154-
// a/index.d.ts
155-
export { ComponentA } from "./ComponentA/ComponentA/index.jsx";
156-
//# sourceMappingURL=index.d.ts.map
157-
158-
// a/index.d.ts.map
159-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../fixtures/entry-points-22/a/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
160-
161-
// a/index.js
162-
export { ComponentA } from './ComponentA/ComponentA/index.js';
163-
164-
165-
// b/ComponentB/ComponentB/index.d.ts
166-
import React from "react";
167-
interface ComponentBProps {
168-
test: string;
169-
}
170-
export declare function ComponentB(props: ComponentBProps): React.JSX.Element;
171-
export {};
172-
//# sourceMappingURL=index.d.ts.map
173-
174-
// b/ComponentB/ComponentB/index.d.ts.map
175-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../fixtures/entry-points-22/b/ComponentB/ComponentB.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAGpE"}
176-
177-
// b/ComponentB/ComponentB/index.js
178-
import React from 'react';
179-
180-
function ComponentB(props) {
181-
const { test } = props;
182-
return /* @__PURE__ */ React.createElement(React.Fragment, null, "ComponentB: ", test);
183-
}
184-
185-
export { ComponentB };
186-
187-
188-
// b/index.d.ts
189-
export { ComponentB } from "./ComponentB/ComponentB/index.jsx";
190-
//# sourceMappingURL=index.d.ts.map
191-
192-
// b/index.d.ts.map
193-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../fixtures/entry-points-22/b/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
194-
195-
// b/index.js
196-
export { ComponentB } from './ComponentB/ComponentB/index.js';
197-
"
198-
`;
199-
200-
exports[`rollup > write entry-points (#34) 1`] = `
201-
"// foo/bar.d.ts
202-
export type * from './bar/baz.js';
203-
export type * from '../index.js';
204-
//# sourceMappingURL=bar.d.ts.map
205-
206-
// foo/bar.d.ts.map
207-
{"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../../fixtures/entry-points-34/foo/bar/bar.ts"],"names":[],"mappings":"AAAA,mBAAmB,OAAO,CAAA;AAC1B,mBAAmB,YAAY,CAAA"}
208-
209-
// foo/bar.js
210-
211-
212-
213-
// foo/bar/baz.d.ts
214-
export type * from '../bar.js';
215-
export type * from '../../index.js';
216-
//# sourceMappingURL=baz.d.ts.map
217-
218-
// foo/bar/baz.d.ts.map
219-
{"version":3,"file":"baz.d.ts","sourceRoot":"","sources":["../../../../../fixtures/entry-points-34/foo/bar/baz.ts"],"names":[],"mappings":"AAAA,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,YAAY,CAAA"}
220-
221-
// index.d.ts
222-
export * from './foo/bar.js';
223-
export * from './foo/bar/baz.js';
224-
//# sourceMappingURL=index.d.ts.map
225-
226-
// index.d.ts.map
227-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../fixtures/entry-points-34/main.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA"}
228-
229-
// index.js
230-
231-
"
232-
`;

0 commit comments

Comments
 (0)