Files
pezkuwi-dev/packages/dev-test/src/env/suite.spec.ts
T
pezkuwichain b65f265e87 Fix TypeScript type definitions for test suite
- Add explicit Describe and It interfaces with todo support
- Fix mock type compatibility in jest.ts
- Update import assertions to import attributes (assert -> with)
- Add dynamic.d.mts declaration file
- Fix spec files to use explicit type declarations
2026-01-17 21:02:45 +03:00

68 lines
1.7 KiB
TypeScript

// Copyright 2017-2026 @pezkuwi/dev-test authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '../globals.d.ts';
declare const describe: import('./suite.js').Describe;
declare const it: import('./suite.js').It;
declare const expect: (value: unknown) => { toBe: (expected: unknown) => void; toBeDefined: () => void };
describe('describe()', () => {
// eslint-disable-next-line jest/no-focused-tests
describe.only('.only', () => {
it('runs this one', () => {
expect(true).toBe(true);
});
});
describe('.skip', () => {
// eslint-disable-next-line jest/no-disabled-tests
describe.skip('.only (.skip)', () => {
it('skips inside .only', () => {
expect(true).toBe(true);
throw new Error('FATAL: This should not run');
});
});
});
});
describe('it()', () => {
it('has been enhanced', () => {
expect(it.todo).toBeDefined();
});
it('allows promises', async () => {
expect(await Promise.resolve(true)).toBe(true);
});
describe('.only', () => {
// eslint-disable-next-line jest/no-focused-tests
it.only('runs this test when .only is used', () => {
expect(true).toBe(true);
});
// eslint-disable-next-line jest/no-disabled-tests
it.skip('skips when .skip is used', () => {
expect(true).toBe(true);
throw new Error('FATAL: This should not run');
});
});
describe('.skip', () => {
// eslint-disable-next-line jest/no-disabled-tests
it.skip('skips when .skip is used', () => {
expect(true).toBe(true);
throw new Error('FATAL: This should not run');
});
});
describe('.todo', () => {
it.todo('marks as a todo when .todo is used', () => {
expect(true).toBe(true);
});
});
});