Skip to content

Commit 1246e03

Browse files
authored
chore: use viteOverrides instead of the cli options (#8144)
1 parent a8a8836 commit 1246e03

30 files changed

+272
-234
lines changed

test/benchmark/test/basic.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ it('basic', { timeout: 60_000 }, async () => {
1616

1717
// Verify that type testing cannot be used with benchmark
1818
typecheck: { enabled: true },
19-
}, [], 'benchmark')
19+
}, [], { mode: 'benchmark' })
2020
expect(result.stderr).toBe('')
2121
expect(result.exitCode).toBe(0)
2222

test/benchmark/test/compare.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('compare', { timeout: 60_000 }, async () => {
1111
root: './fixtures/compare',
1212
outputJson: './bench.json',
1313
reporters: ['default'],
14-
}, [], 'benchmark')
14+
}, [], { mode: 'benchmark' })
1515
expect(result.exitCode).toBe(0)
1616
expect(fs.existsSync('./fixtures/compare/bench.json')).toBe(true)
1717
}
@@ -22,7 +22,7 @@ test('compare', { timeout: 60_000 }, async () => {
2222
root: './fixtures/compare',
2323
compare: './bench.json',
2424
reporters: ['default'],
25-
}, [], 'benchmark')
25+
}, [], { mode: 'benchmark' })
2626
expect(result.exitCode).toBe(0)
2727
const lines = result.stdout.split('\n').slice(4).slice(0, 6)
2828
const expected = `

test/benchmark/test/reporter.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { runVitest } from '../../test-utils'
44

55
it('summary', async () => {
66
const root = pathe.join(import.meta.dirname, '../fixtures/reporter')
7-
const result = await runVitest({ root }, ['summary.bench.ts'], 'benchmark')
7+
const result = await runVitest({ root }, ['summary.bench.ts'], { mode: 'benchmark' })
88
expect(result.stderr).toBe('')
99
expect(result.stdout).not.toContain('NaNx')
1010
expect(result.stdout.split('BENCH Summary')[1].replaceAll(/[0-9.]+x/g, '(?)')).toMatchSnapshot()
1111
})
1212

1313
it('non-tty', async () => {
1414
const root = pathe.join(import.meta.dirname, '../fixtures/basic')
15-
const result = await runVitest({ root }, ['base.bench.ts'], 'benchmark')
15+
const result = await runVitest({ root }, ['base.bench.ts'], { mode: 'benchmark' })
1616
const lines = result.stdout.split('\n').slice(4).slice(0, 11)
1717
const expected = `\
1818
✓ base.bench.ts > sort
@@ -40,7 +40,7 @@ it.for([true, false])('includeSamples %s', async (includeSamples) => {
4040
benchmark: { includeSamples },
4141
},
4242
['summary.bench.ts'],
43-
'benchmark',
43+
{ mode: 'benchmark' },
4444
)
4545
assert(result.ctx)
4646
const allSamples = [...result.ctx.state.idMap.values()]

test/benchmark/test/sequential.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { runVitest } from '../../test-utils'
55

66
it('sequential', async () => {
77
const root = pathe.join(import.meta.dirname, '../fixtures/sequential')
8-
await runVitest({ root }, [], 'benchmark')
8+
await runVitest({ root }, [], { mode: 'benchmark' })
99
const testLog = await fs.promises.readFile(pathe.join(root, 'test.log'), 'utf-8')
1010
expect(testLog).toMatchSnapshot()
1111
})

test/browser/specs/benchmark.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { runVitest } from '../../test-utils'
44
const IS_PLAYWRIGHT = process.env.PROVIDER === 'playwright'
55

66
test('benchmark', async () => {
7-
const result = await runVitest({ root: 'fixtures/benchmark' }, [], 'benchmark')
7+
const result = await runVitest({ root: 'fixtures/benchmark' }, [], { mode: 'benchmark' })
88
expect(result.stderr).toReportNoErrors()
99

1010
if (IS_PLAYWRIGHT) {

test/cli/test/annotations.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ describe('API', () => {
5858
'basic.test.ts': annotationTest,
5959
'test-3.js': test3Content,
6060
'test-4.js': '',
61+
'vitest.config.js': { test: options },
6162
},
6263
{
6364
includeTaskLocation: true,
@@ -97,10 +98,6 @@ describe('API', () => {
9798
},
9899
],
99100
},
100-
{},
101-
{
102-
test: options,
103-
},
104101
)
105102

106103
expect(stderr).toBe('')

test/cli/test/artifacts.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ describe('API', () => {
5858
'test-4.js': '',
5959
},
6060
{
61+
...options,
6162
includeTaskLocation: true,
6263
reporters: [
6364
'default',
@@ -100,10 +101,6 @@ describe('API', () => {
100101
},
101102
],
102103
},
103-
{},
104-
{
105-
test: options,
106-
},
107104
)
108105

109106
expect(stderr).toBe('')

test/cli/test/fails.test.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,12 @@ it('prints a warning if the assertion is not awaited in the browser mode', async
116116
expect(Promise.resolve(1)).resolves.toBe(1)
117117
})
118118
`,
119-
}, {}, {}, {
120-
test: {
121-
browser: {
122-
enabled: true,
123-
instances: [{ browser: 'chromium' }],
124-
provider: playwright(),
125-
headless: true,
126-
},
119+
}, {
120+
browser: {
121+
enabled: true,
122+
instances: [{ browser: 'chromium' }],
123+
provider: playwright(),
124+
headless: true,
127125
},
128126
})
129127
expect(stderr).toContain('Promise returned by \`expect(actual).resolves.toBe(expected)\` was not awaited')

test/cli/test/group-order.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test('tests run according to the group order', async () => {
88
'example.2-2.test.ts': `test('2-2', () => {})`,
99
'example.3.test.ts': `test('3', () => {})`,
1010
}, {
11-
globals: true,
11+
$cliOptions: { globals: true },
1212
// run projects in the opposite order!
1313
projects: [
1414
{

test/cli/test/open-telemetry.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ describe.for([
4848
// root needs to be set before vitest sets up,
4949
// but browser options need to be in the config already
5050
root: './fixtures/otel-tests',
51-
}, [], 'test', {
52-
test: (type === 'root'
51+
...(type === 'root'
5352
? config
5453
: { projects: [{ test: config }] }),
5554
})

0 commit comments

Comments
 (0)