(terserOptions: TerserOptions)
| 6 | |
| 7 | describe('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({}) |
no test coverage detected