testy
testy copied to clipboard
[feature] allow only a specific test/suite to be run
Is your feature request related to a problem? Please describe. It would be nice to have a feature/function which allows to run only a specific suite or a single/multiple tests in a suite
Describe the solution you'd like
A single file having multiple suites and .only allows only one suite to be run
suite.only('test suite1', () => {
test('test-1.1', () => {
assert.isTrue(true);
});
})
suite('test suite2', () => {
test('test-2.1', () => {
assert.isTrue(false);
});
})
when testy in run for this file, it should only execute the test suite1
Similarly,
suite('test suite1', () => {
test.only('test-1.1', () => {
assert.isTrue(true);
});
test('test-1.2', () => {
assert.isTrue(false);
});
})
when testy in run for this file, it should only execute the test-1.1
I like this idea, I had written #53 to also solve that problem but I think both approaches can exist. I used focus: true feature in RSpec that is a bit similar. What about using this syntax:
test('to be executed', () => {
}).only();
that way we won't require extra require statements. I think also this can be used for tagging (just thinking out loud :D )
test('to be executed', () => {
}).taggedAs('slow', 'flaky', ...);
I just realized it's possible to implement test.only or test.suite without too much effort. When this is activated, all the other tests are skipped.
This will be the next feature in the priority list!
@beluamat29 This is a duplicate of #307, would you close the most recent one?