Skip to content

Commit 497b7f6

Browse files
committed
fix(test): output a .js bundle, not .ts
- woooops... was wondering why it was `.ts`; turns out because I wrote the `output.file` setting that way 😅 😅 😅 - also add a missing comment in errors for consistency - and put code checks _after_ file structure checks, since that's a deeper check
1 parent c51e45d commit 497b7f6

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

__tests__/integration/errors.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ test("integration - errors - abortOnError: false / check: false", async () => {
4040
const { output: output2 } = await genBundle({ check: false });
4141
expect(output).toEqual(output2);
4242

43-
expect(output[0].fileName).toEqual("index.ts");
43+
expect(output[0].fileName).toEqual("index.js");
4444
expect(output[1].fileName).toEqual("index.d.ts");
4545
expect(output[2].fileName).toEqual("index.d.ts.map");
46-
expect(output.length).toEqual(3);
46+
expect(output.length).toEqual(3); // no other files
4747
expect(onwarn).toBeCalledTimes(1);
4848
});
4949

__tests__/integration/helpers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function genBundle ({ input, tsconfig, cacheRoot, extraOpts, onwarn
2222
});
2323

2424
const esm = await bundle.generate({
25-
file: "./dist/index.ts",
25+
file: "./dist/index.js",
2626
format: "esm",
2727
exports: "named",
2828
});

__tests__/integration/no-errors.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ test("integration - no errors", async () => {
3030
const { output: outputWithCache } = await genBundle();
3131
expect(output).toEqual(outputWithCache);
3232

33-
// JS file should be bundled by Rollup, even though rpt2 does not resolve it (as Rollup natively understands ESM)
34-
expect(output[0].code).toEqual(expect.stringContaining("identity"));
35-
36-
expect(output[0].fileName).toEqual("index.ts");
33+
expect(output[0].fileName).toEqual("index.js");
3734
expect(output[1].fileName).toEqual("index.d.ts");
3835
expect(output[2].fileName).toEqual("index.d.ts.map");
3936
expect(output[3].fileName).toEqual("some-import.d.ts");
4037
expect(output[4].fileName).toEqual("some-import.d.ts.map");
4138
expect(output[5].fileName).toEqual("type-only-import.d.ts");
4239
expect(output[6].fileName).toEqual("type-only-import.d.ts.map");
4340
expect(output.length).toEqual(7); // no other files
41+
42+
// JS file should be bundled by Rollup, even though rpt2 does not resolve it (as Rollup natively understands ESM)
43+
expect(output[0].code).toEqual(expect.stringContaining("identity"));
4444
});
4545

4646
test("integration - no errors - no declaration maps", async () => {
@@ -50,7 +50,7 @@ test("integration - no errors - no declaration maps", async () => {
5050
clean: true,
5151
});
5252

53-
expect(output[0].fileName).toEqual("index.ts");
53+
expect(output[0].fileName).toEqual("index.js");
5454
expect(output[1].fileName).toEqual("index.d.ts");
5555
expect(output[2].fileName).toEqual("some-import.d.ts");
5656
expect(output[3].fileName).toEqual("type-only-import.d.ts");
@@ -65,6 +65,6 @@ test("integration - no errors - no declarations", async () => {
6565
clean: true,
6666
});
6767

68-
expect(output[0].fileName).toEqual("index.ts");
68+
expect(output[0].fileName).toEqual("index.js");
6969
expect(output.length).toEqual(1); // no other files
7070
});

0 commit comments

Comments
 (0)