• Run setup code before all tests in the current suite. MUST be used within a describe block. Only executes if any test in the suite is enabled through testEnableControl. Used for one-time setup operations like initializing hardware, loading configuration, or establishing database connections.

    Parameters

    • fn: () => void | Promise<void>

      Function to run before all tests (can be sync or async)

    Returns void

    describe('Hardware Integration Tests', () => {
    // ✅ Correct: before inside describe block
    before(async () => {
    await hardware.initialize();
    await hardware.selfTest();
    });

    before(() => {
    config = loadTestConfig('test-settings.json');
    process.env.TEST_MODE = 'true';
    });

    test('should connect to ECU', () => {
    // Test implementation
    });
    });

    // ❌ Wrong: before outside describe block
    // before(() => { // This will not work properly });