Skip to content

Make .only sticky in watch mode #593

@novemberborn

Description

@novemberborn

#556 makes .only work across all test files. However this won't work the same when in watch mode since only a subset of the test files are run when changes occur.

Let's say we have two test files: foo.js and bar.js. The latter contains a .only.

Initially all test files are run and because bar.js contains a .only, only that test is actually executed.

Subsequently foo.js is changed. The watcher will run just foo.js which does not contain a .only. Now all tests in foo.js are executed.

Later a non-test file is changed and all test files are rerun. Only the .only test from bar.js is executed.

This isn't necessarily bad but it may be surprising to some. I wonder if .only should be sticky so that when changes are detected the watcher still only executes .only tests. But then if you remove the .only it starts executing all tests again. Similarly adding a .only switches back into the sticky mode.

We could build upon #544 which already performs some per-test-file bookkeeping.

Thoughts?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions