mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 15:36:33 +00:00
fix(client): lint:skips counts skipIf(true) and runIf(false)
skipIf and runIf were left out as run-time skips, which they are with a real condition. With the literal true (skipIf) or false (runIf) they switch a test off for good and gave a free way past the ratchet, while the same file already counted Playwright's test.skip(true, 'why') for that reason. Both now count as skips; nothing in the client uses them today, so the counts stay as they are.
This commit is contained in:
@@ -142,6 +142,22 @@ describe('lint:skips', () => {
|
||||
expect(run({}, { 'e2e/c.spec.ts': conditional })).toBe(0);
|
||||
});
|
||||
|
||||
it('SKIPS-012: counts skipIf(true) and runIf(false), whose condition can never change', () => {
|
||||
const source = [
|
||||
"it.skipIf(true)('a', () => {})",
|
||||
"describe.runIf(false)('b', () => {})",
|
||||
"test.skipIf(true).each([1])('c %s', () => {})",
|
||||
"it.skipIf(false)('d', () => {})",
|
||||
"describe.runIf(true)('e', () => {})",
|
||||
"it.skipIf(isCI)('f', () => {})",
|
||||
].join('\n');
|
||||
expect(modifiers(source, 'tests/a.test.ts').skipped.map((s: string) => s.split(':')[0])).toEqual(['1', '2', '3']);
|
||||
expect(
|
||||
run({}, { 'tests/b.test.ts': "it.skipIf(true)('a', () => {});\ndescribe.runIf(false)('b', () => {});\n" })
|
||||
).toBe(1);
|
||||
expect(tree.error.join('\n')).toMatch(/tests\/b\.test\.ts: 2 skipped or todo test\(s\), baseline 0/);
|
||||
});
|
||||
|
||||
it('SKIPS-008: a missing baseline or test directory stops the check', () => {
|
||||
tree = ratchetTree({ 'src/a.test.ts': PASSING, 'tests/b.test.ts': PASSING, 'e2e/c.spec.ts': PASSING });
|
||||
expect(() => check({ root: tree.root, baselinePath: tree.path(BASELINE), ...tree.out })).toThrow(RatchetError);
|
||||
|
||||
Reference in New Issue
Block a user