The legislation would avert a government shutdown on Friday, when federal funding is due to expire, and boost defense and nondefense programs.