Skip to content

Commit d034a1b

Browse files
committed
test: rolldown
1 parent c5117f6 commit d034a1b

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"editor.formatOnSave": true,
3-
"eslint.experimental.useFlatConfig": true
2+
"editor.formatOnSave": true
43
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`rolldown 1`] = `
4+
"// main.js
5+
const values = [
6+
"foo",
7+
100,
8+
4
9+
];
10+
console.log("foo", 100, 4);
11+
console.log(values);
12+
"
13+
`;

tests/rolldown.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import path from 'node:path'
2+
import { rolldownBuild } from '@sxzz/test-utils'
3+
import Oxc from 'unplugin-oxc/rolldown'
4+
import { expect, test } from 'vitest'
5+
import UnpluginInlineEnum from '../src/rolldown'
6+
7+
test('rolldown', async () => {
8+
const { snapshot } = await rolldownBuild(
9+
path.resolve(__dirname, 'fixtures/main.ts'),
10+
[
11+
UnpluginInlineEnum({
12+
scanDir: path.resolve(__dirname, 'fixtures'),
13+
scanMode: 'fs',
14+
}),
15+
Oxc(),
16+
],
17+
{},
18+
{ minify: 'dce-only' },
19+
)
20+
expect(snapshot).toMatchSnapshot()
21+
})

tests/rollup.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ test('rollup', async () => {
1313
scanMode: 'fs',
1414
}),
1515
Oxc(),
16-
{
17-
name: 'test:mod-options',
18-
options(options) {
19-
options.treeshake = 'smallest'
20-
},
21-
},
2216
],
17+
{
18+
treeshake: 'smallest',
19+
},
2320
)
2421
expect(snapshot).toMatchSnapshot()
2522
})

0 commit comments

Comments
 (0)