|
| 1 | +import { join } from 'node:path'; |
| 2 | +import { buildAndGetResults } from '@e2e/helper'; |
| 3 | +import { expect, test } from 'vitest'; |
| 4 | + |
| 5 | +test('single entry bundle', async () => { |
| 6 | + const fixturePath = join(__dirname, 'single'); |
| 7 | + const { files } = await buildAndGetResults(fixturePath); |
| 8 | + |
| 9 | + expect(files).toMatchInlineSnapshot(` |
| 10 | + { |
| 11 | + "cjs": [ |
| 12 | + "<ROOT>/e2e/cases/entry/single/dist/cjs/index.cjs", |
| 13 | + ], |
| 14 | + "esm": [ |
| 15 | + "<ROOT>/e2e/cases/entry/single/dist/esm/index.js", |
| 16 | + ], |
| 17 | + } |
| 18 | + `); |
| 19 | +}); |
| 20 | + |
| 21 | +test('multiple entry bundle', async () => { |
| 22 | + const fixturePath = join(__dirname, 'multiple'); |
| 23 | + const { files } = await buildAndGetResults(fixturePath); |
| 24 | + |
| 25 | + expect(files).toMatchInlineSnapshot(` |
| 26 | + { |
| 27 | + "cjs": [ |
| 28 | + "<ROOT>/e2e/cases/entry/multiple/dist/cjs/bar.cjs", |
| 29 | + "<ROOT>/e2e/cases/entry/multiple/dist/cjs/index.cjs", |
| 30 | + ], |
| 31 | + "esm": [ |
| 32 | + "<ROOT>/e2e/cases/entry/multiple/dist/esm/bar.js", |
| 33 | + "<ROOT>/e2e/cases/entry/multiple/dist/esm/index.js", |
| 34 | + ], |
| 35 | + } |
| 36 | + `); |
| 37 | +}); |
| 38 | + |
| 39 | +test('glob entry bundleless', async () => { |
| 40 | + const fixturePath = join(__dirname, 'glob'); |
| 41 | + const { files } = await buildAndGetResults(fixturePath); |
| 42 | + |
| 43 | + expect(files).toMatchInlineSnapshot(` |
| 44 | + { |
| 45 | + "cjs": [ |
| 46 | + "<ROOT>/e2e/cases/entry/glob/dist/cjs/bar.cjs", |
| 47 | + "<ROOT>/e2e/cases/entry/glob/dist/cjs/foo.cjs", |
| 48 | + "<ROOT>/e2e/cases/entry/glob/dist/cjs/index.cjs", |
| 49 | + ], |
| 50 | + "esm": [ |
| 51 | + "<ROOT>/e2e/cases/entry/glob/dist/esm/bar.js", |
| 52 | + "<ROOT>/e2e/cases/entry/glob/dist/esm/foo.js", |
| 53 | + "<ROOT>/e2e/cases/entry/glob/dist/esm/index.js", |
| 54 | + ], |
| 55 | + } |
| 56 | + `); |
| 57 | +}); |
0 commit comments