This doesn't happen very often but sometimes I get a client that gets a job offer they can't refuse. How does that affect their mortgage approval? It really depends on a few different things. Ideally, it is best to wait until after you have closed, but sometimes it's not possible.
As long as you are staying in the same line of work and get a regular salary or hourly pay, a new job may not affect you. Expect that you will need at least one paystub (maybe 2) from your new employer before you can close. Your lender will probably send your new employer a written verification of employer. Make sure that there is enough time for you to get a paystub and have your mortgage underwritten before you close.
If your income is changing from salary or hourly to commission, you will have problems with your mortgage approval. Underwriting guidelines require a two year history to use commission, overtime or bonus income. If you are becoming self employed, you will also need a two year history before we can use that income.
If you are getting a salary but also a bonus, typically underwriting will only use the base salary until you have two years on that job. So if your base salary is decreasing (even if your total income may increase), you may have an issue with a loan approval.