• Run cleanup code after all tests in the current suite. MUST be used within a describe block. Only executes if any test in the suite was enabled through testEnableControl. Used for final cleanup operations like closing hardware connections, saving test reports, or cleaning up temporary files.

    Parameters

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

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

    Returns void

    describe('System Integration Tests', () => {
    // ✅ Correct: after inside describe block
    after(async () => {
    await hardware.shutdown();
    await hardware.disconnect();
    });

    after(() => {
    saveTestReport(testResults);
    delete process.env.TEST_MODE;
    console.log('All tests completed');
    });

    test('should perform system check', () => {
    // Test implementation
    });
    });

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