MCPcopy
hub / github.com/vitejs/vite / run

Function run

packages/vite/src/node/__tests__/plugins/terser.spec.ts:8–39  ·  view source on GitHub ↗
(terserOptions: TerserOptions)

Source from the content-addressed store, hash-verified

6
7describe('terser', () => {
8 const run = async (terserOptions: TerserOptions) => {
9 const result = (await build({
10 root: resolve(import.meta.dirname, '../packages/build-project'),
11 logLevel: 'silent',
12 build: {
13 write: false,
14 minify: 'terser',
15 terserOptions,
16 },
17 plugins: [
18 {
19 name: 'test',
20 resolveId(id) {
21 if (id === 'entry.js') {
22 return '\0' + id
23 }
24 },
25 load(id) {
26 if (id === '\0entry.js') {
27 return `
28 const foo = 1;
29 console.log(foo);
30 const bar = { hello: 1, ["world"]: 2 };
31 console.log(bar.hello + bar["world"]);
32 `
33 }
34 },
35 },
36 ],
37 })) as RollupOutput
38 return result.output[0].code
39 }
40
41 test('basic', async () => {
42 await run({})

Callers 1

terser.spec.tsFile · 0.70

Calls 2

buildFunction · 0.90
resolveFunction · 0.50

Tested by

no test coverage detected