Skip to content

Commit e345b1c

Browse files
committed
WIP execution test
1 parent 9576042 commit e345b1c

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function unusedHelper() {
2+
return 'this is unused helper'
3+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { unusedHelper } from './c-unused'
2+
3+
export function c() {
4+
return 'this is c.js'
5+
}
6+
7+
export function unused() {
8+
return unusedHelper()
9+
}

turbopack/crates/turbopack-tests/tests/execution/turbopack/collect/basic/input/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ const getList = __turbopack_collect__({
77
it('should work', async () => {
88
const list = getList()
99
expect(list).toEqual([
10+
expect.objectContaining({
11+
id: '[project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/collect/basic/input/c.js [test] (ecmascript)',
12+
data: 'data-for-c',
13+
}),
1014
expect.objectContaining({
1115
id: '[project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/collect/basic/input/a.js [test] (ecmascript)',
1216
data: 'data-for-a',
@@ -17,6 +21,10 @@ it('should work', async () => {
1721
}),
1822
])
1923

20-
expect((await list[0].import()).a()).toEqual('this is a.js')
21-
expect((await list[1].import()).b()).toEqual('this is b.js')
24+
expect((await list[0].import()).c()).toEqual('this is c.js')
25+
expect((await list[1].import()).a()).toEqual('this is a.js')
26+
expect((await list[2].import()).b()).toEqual('this is b.js')
27+
28+
const modules = Array.from(__turbopack_modules__.keys())
29+
expect(modules).not.toContainEqual(expect.stringMatching(/input\/c-unused/))
2230
})

turbopack/crates/turbopack-tests/tests/execution/turbopack/collect/basic/input/lib.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ __turbopack_emit__('./a.js', {
33
data: 'data-for-a',
44
})
55

6-
console.log('this is lib.js')
6+
__turbopack_emit__('./c.js', {
7+
namespace: 'my-test',
8+
data: 'data-for-c',
9+
exports: ['c'],
10+
})
11+
712
export default function () {
813
import('./async')
914
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"inferModuleSideEffects": false,
3-
"removeUnusedExports": false
2+
"scopeHoisting": false
43
}

0 commit comments

Comments
 (0)