Keep it off when the cops are around and when the vehicle is tested.
Typical emissions testing has looked for catalytic converter bypasses for years. By bypassing it, your mileage goes up considerable, at least in older cars. Computer controlled cars likely adjust for it.
Even if you created such a bypass for a diesel, you would likely get so much waste carbon in your exhaust that your particulate readings would still be high 20 miles later.