Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: check related against
forceRerunTriggers
(#1595)
* feat: check related against forceRerunTriggers * chore: fix lock * check length of micromatch * add execa * add force-rerun tests and vitest config * update docs * watch false on related * typo * linting * fix lock and add timeout to tests * add defaults to forceRerunTriggers * chore: remove dist from forceRerunTriggers * Wording Co-authored-by: Vladimir Sheremet <sheremet.va@icloud.com>
- Loading branch information
1 parent
0a642c6
commit 40fc526
Showing
8 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
include: ['tests/related.test.ts'], | ||
forceRerunTriggers: ['**/rerun.temp/**'], | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { unlink, writeFile } from 'fs' | ||
import { beforeEach, describe, expect, it } from 'vitest' | ||
import { execa } from 'execa' | ||
|
||
const run = async () => await execa('vitest', ['run', '--changed', '--config', 'force-rerun.vitest.config.ts']) | ||
|
||
const fileName = 'rerun.temp' | ||
|
||
describe('forceRerunTrigger', () => { | ||
beforeEach(async () => { | ||
unlink(fileName, () => {}) | ||
}) | ||
|
||
it('should run the whole test suite if file exists', async () => { | ||
writeFile(fileName, '', () => {}) | ||
const { stdout } = await run() | ||
expect(stdout).toContain('1 passed') | ||
}, 60_000) | ||
|
||
it('should run no tests if file does not exist', async () => { | ||
const { stdout } = await run() | ||
expect(stdout).toContain('No test files found, exiting with code 0') | ||
}, 60_000) | ||
}) |