Skip to content

Commit

Permalink
chore: change test
Browse files Browse the repository at this point in the history
  • Loading branch information
mysteryven committed Dec 31, 2022
1 parent 20f0c47 commit d32f853
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
6 changes: 6 additions & 0 deletions test/reporters/tests/custom-reporter.spec.ts
Expand Up @@ -71,4 +71,10 @@ describe.concurrent('custom reporters', () => {
const stdout = await runWithRetry('--config', 'without-custom-reporter.vitest.config.ts', '--reporter', customJSReporterPath)
expect(stdout).includes('hello from custom reporter')
}, TIMEOUT)

test('overrides reporters by given a CLI argument --reporter works', async () => {
const stdout = await runWithRetry('--config', 'deps-reporter.vitest.config.ts', '--reporter', customJSReporterPath)
expect(stdout).not.includes('hello from package reporter')
expect(stdout).includes('hello from custom reporter')
}, TIMEOUT)
})
19 changes: 0 additions & 19 deletions test/reporters/tests/reporters.spec.ts
Expand Up @@ -343,25 +343,6 @@ test('json reporter with outputFile object in non-existing directory', async ()
rmSync(rootDirectory, { recursive: true })
})

const skip = (process.platform === 'win32' || process.platform === 'darwin') && process.env.CI
const root = resolve(__dirname, '../fixtures')

test.skipIf(skip)('Cli can overrides reporters by --reporter', async () => {
const { stdout } = await execa('npx', ['vitest', 'run', 'all-passing-or-skipped.test.ts', '--reporter=json'], {
cwd: root,
env: {
...process.env,
CI: 'true',
NO_COLOR: 'true',
},
stdio: 'pipe',
}).catch(e => e)

expect(() => {
JSON.parse(stdout)
}).not.toThrowError()
}, 60_000)

/**
* Ensure environment and OS specific paths are consistent in snapshots
*/
Expand Down

0 comments on commit d32f853

Please sign in to comment.