-
Notifications
You must be signed in to change notification settings - Fork 27.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Improve testing system for tree shaker (vercel/turborepo#4663)
### Description We need a testing system that supports enabling only _some_ of exports. This PR implements it by using `config.json`. Fix WEB-917. ### Testing Instructions Look at output.mdx
- Loading branch information
Showing
4 changed files
with
810 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"exports":[ | ||
["external1"], | ||
["external1", "external2"] | ||
] | ||
} |
18 changes: 18 additions & 0 deletions
18
crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { upper } from "module"; | ||
export let foobar = "foo"; | ||
export const foo = foobar; | ||
const bar = "bar"; | ||
foobar += bar; | ||
let foobarCopy = foobar; | ||
foobar += "foo"; | ||
console.log(foobarCopy); | ||
foobarCopy += "Unused"; | ||
function internal() { | ||
return upper(foobar); | ||
} | ||
export function external1() { | ||
return internal() + foobar; | ||
} | ||
export function external2() { | ||
foobar += "."; | ||
} |
Oops, something went wrong.