Skip to content

Commit

Permalink
Address feedback p2
Browse files Browse the repository at this point in the history
  • Loading branch information
kemmerle committed Jan 17, 2025
1 parent ee15a6b commit 16aafdc
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions lib/projects/__tests__/projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,22 @@ jest.mock('@hubspot/local-dev-lib/logger');

describe('lib/projects', () => {
describe('validateProjectConfig()', () => {
let realProcess: NodeJS.Process;
let projectDir: string;
let exitMock: jest.Mock;
let exitMock: jest.SpyInstance;

beforeAll(() => {
projectDir = fs.mkdtempSync(path.join(os.tmpdir(), 'projects-'));
fs.mkdirSync(path.join(projectDir, 'src'));

realProcess = process;
});

beforeEach(() => {
exitMock = jest.fn();
global.process = {
...realProcess,
exit: exitMock as unknown as (
code?: number | string | null | undefined
) => never,
};
exitMock = jest.spyOn(process, 'exit').mockImplementation((): never => {
throw new Error('process.exit() was called.');
});
});

afterAll(() => {
global.process = realProcess;
exitMock.mockRestore();
});

it('rejects undefined configuration', () => {
Expand Down

0 comments on commit 16aafdc

Please sign in to comment.