Skip to content

Commit d3e64f1

Browse files
committed
test: update expected output
1 parent fab5016 commit d3e64f1

2 files changed

Lines changed: 6 additions & 80 deletions

File tree

test/integration/global-references/index.test.ts

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@ describe('import globals', () => {
77
const result = await transformDev(`Buffer.from('test')`)
88

99
expect(result?.code).toEqual(formatWhitespace(`
10-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
11-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
12-
import __global_polyfill from "/shims/global/dist/index.js"
13-
globalThis.global = globalThis.global || __global_polyfill
14-
import __process_polyfill from "/shims/process/dist/index.js"
15-
globalThis.process = globalThis.process || __process_polyfill
10+
import { default as Buffer } from "/shims/buffer/dist/index.js";
1611
1712
Buffer.from("test");
1813
`))
@@ -28,8 +23,7 @@ describe('import globals', () => {
2823
})
2924

3025
expect(result?.code).toEqual(formatWhitespace(`
31-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
32-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
26+
import { default as Buffer } from "/shims/buffer/dist/index.js";
3327
3428
Buffer.from("test");
3529
`))
@@ -41,12 +35,7 @@ describe('import globals', () => {
4135
const result = await transformDev(`console.log(global)`)
4236

4337
expect(result?.code).toEqual(formatWhitespace(`
44-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
45-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
46-
import __global_polyfill from "/shims/global/dist/index.js"
47-
globalThis.global = globalThis.global || __global_polyfill
48-
import __process_polyfill from "/shims/process/dist/index.js"
49-
globalThis.process = globalThis.process || __process_polyfill
38+
import { default as global } from "/shims/global/dist/index.js";
5039
5140
console.log(global);
5241
`))
@@ -62,8 +51,7 @@ describe('import globals', () => {
6251
})
6352

6453
expect(result?.code).toEqual(formatWhitespace(`
65-
import __global_polyfill from "/shims/global/dist/index.js"
66-
globalThis.global = globalThis.global || __global_polyfill
54+
import { default as global } from "/shims/global/dist/index.js";
6755
6856
console.log(global);
6957
`))
@@ -75,12 +63,7 @@ describe('import globals', () => {
7563
const result = await transformDev(`console.log(process)`)
7664

7765
expect(result?.code).toEqual(formatWhitespace(`
78-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
79-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
80-
import __global_polyfill from "/shims/global/dist/index.js"
81-
globalThis.global = globalThis.global || __global_polyfill
82-
import __process_polyfill from "/shims/process/dist/index.js"
83-
globalThis.process = globalThis.process || __process_polyfill
66+
import { default as process } from "/shims/process/dist/index.js";
8467
8568
console.log(process);
8669
`))
@@ -96,8 +79,7 @@ describe('import globals', () => {
9679
})
9780

9881
expect(result?.code).toEqual(formatWhitespace(`
99-
import __process_polyfill from "/shims/process/dist/index.js"
100-
globalThis.process = globalThis.process || __process_polyfill
82+
import { default as process } from "/shims/process/dist/index.js";
10183
10284
console.log(process);
10385
`))

test/integration/import-globals/index.test.ts

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ describe('import globals', () => {
1010
`)
1111

1212
expect(result?.code).toEqual(formatWhitespace(`
13-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
14-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
15-
import __global_polyfill from "/shims/global/dist/index.js"
16-
globalThis.global = globalThis.global || __global_polyfill
17-
import __process_polyfill from "/shims/process/dist/index.js"
18-
globalThis.process = globalThis.process || __process_polyfill
19-
2013
import Buffer from "/shims/buffer/dist/index.js";
2114
console.log(Buffer);
2215
`))
@@ -29,13 +22,6 @@ describe('import globals', () => {
2922
`)
3023

3124
expect(result?.code).toEqual(formatWhitespace(`
32-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
33-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
34-
import __global_polyfill from "/shims/global/dist/index.js"
35-
globalThis.global = globalThis.global || __global_polyfill
36-
import __process_polyfill from "/shims/process/dist/index.js"
37-
globalThis.process = globalThis.process || __process_polyfill
38-
3925
import Buffer from "/shims/buffer/dist/index.js";
4026
console.log(Buffer);
4127
`))
@@ -48,13 +34,6 @@ describe('import globals', () => {
4834
`)
4935

5036
expect(result?.code).toEqual(formatWhitespace(`
51-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
52-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
53-
import __global_polyfill from "/shims/global/dist/index.js"
54-
globalThis.global = globalThis.global || __global_polyfill
55-
import __process_polyfill from "/shims/process/dist/index.js"
56-
globalThis.process = globalThis.process || __process_polyfill
57-
5837
import Buffer from "/shims/buffer/dist/index.js";
5938
console.log(Buffer);
6039
`))
@@ -67,13 +46,6 @@ describe('import globals', () => {
6746
`)
6847

6948
expect(result?.code).toEqual(formatWhitespace(`
70-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
71-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
72-
import __global_polyfill from "/shims/global/dist/index.js"
73-
globalThis.global = globalThis.global || __global_polyfill
74-
import __process_polyfill from "/shims/process/dist/index.js"
75-
globalThis.process = globalThis.process || __process_polyfill
76-
7749
import Buffer from "/shims/buffer/dist/index.js";
7850
console.log(Buffer);
7951
`))
@@ -88,13 +60,6 @@ describe('import globals', () => {
8860
`)
8961

9062
expect(result?.code).toEqual(formatWhitespace(`
91-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
92-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
93-
import __global_polyfill from "/shims/global/dist/index.js"
94-
globalThis.global = globalThis.global || __global_polyfill
95-
import __process_polyfill from "/shims/process/dist/index.js"
96-
globalThis.process = globalThis.process || __process_polyfill
97-
9863
import process from "/shims/process/dist/index.js";
9964
console.log(process);
10065
`))
@@ -107,13 +72,6 @@ describe('import globals', () => {
10772
`)
10873

10974
expect(result?.code).toEqual(formatWhitespace(`
110-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
111-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
112-
import __global_polyfill from "/shims/global/dist/index.js"
113-
globalThis.global = globalThis.global || __global_polyfill
114-
import __process_polyfill from "/shims/process/dist/index.js"
115-
globalThis.process = globalThis.process || __process_polyfill
116-
11775
import process from "/shims/process/dist/index.js";
11876
console.log(process);
11977
`))
@@ -126,13 +84,6 @@ describe('import globals', () => {
12684
`)
12785

12886
expect(result?.code).toEqual(formatWhitespace(`
129-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
130-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
131-
import __global_polyfill from "/shims/global/dist/index.js"
132-
globalThis.global = globalThis.global || __global_polyfill
133-
import __process_polyfill from "/shims/process/dist/index.js"
134-
globalThis.process = globalThis.process || __process_polyfill
135-
13687
import process from "/shims/process/dist/index.js";
13788
console.log(process);
13889
`))
@@ -145,13 +96,6 @@ describe('import globals', () => {
14596
`)
14697

14798
expect(result?.code).toEqual(formatWhitespace(`
148-
import __buffer_polyfill from "/shims/buffer/dist/index.js"
149-
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
150-
import __global_polyfill from "/shims/global/dist/index.js"
151-
globalThis.global = globalThis.global || __global_polyfill
152-
import __process_polyfill from "/shims/process/dist/index.js"
153-
globalThis.process = globalThis.process || __process_polyfill
154-
15599
import process from "/shims/process/dist/index.js";
156100
console.log(process);
157101
`))

0 commit comments

Comments
 (0)