-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
37 lines (31 loc) · 865 Bytes
/
Copy pathjest.setup.js
File metadata and controls
37 lines (31 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Jest setup file for additional configuration
// Mock chalk to avoid ESM issues
const mockChalk = {
blue: Object.assign((str) => str, { bold: (str) => str }),
yellow: Object.assign((str) => str, { bold: (str) => str }),
green: Object.assign((str) => str, { bold: (str) => str }),
red: (str) => str,
gray: (str) => str,
cyan: (str) => str
};
jest.mock('chalk', () => ({
default: mockChalk,
...mockChalk
}));
// Mock inquirer to avoid ESM issues
jest.mock('inquirer', () => ({
default: {
prompt: jest.fn()
},
prompt: jest.fn()
}));
// Set up environment variables for tests
process.env.NODE_ENV = 'test';
// Mock process.cwd() to return a consistent test directory
const originalCwd = process.cwd;
beforeEach(() => {
process.cwd = jest.fn().mockReturnValue('/test/project');
});
afterEach(() => {
process.cwd = originalCwd;
});