-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathgenerator.int.test.ts
More file actions
49 lines (42 loc) · 1.32 KB
/
generator.int.test.ts
File metadata and controls
49 lines (42 loc) · 1.32 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
import {
type Tree,
addProjectConfiguration,
logger,
readProjectConfiguration,
} from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import * as path from 'node:path';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { configurationGenerator } from './generator.js';
describe('configurationGenerator', () => {
let tree: Tree;
const testProjectName = 'test-app';
const loggerInfoSpy = vi.spyOn(logger, 'info');
beforeEach(() => {
tree = createTreeWithEmptyWorkspace();
addProjectConfiguration(tree, 'test-app', {
root: 'test-app',
});
});
afterEach(() => {
tree.delete(testProjectName);
});
it('should skip config creation if skipConfig is used', async () => {
await configurationGenerator(tree, {
project: testProjectName,
skipConfig: true,
});
readProjectConfiguration(tree, testProjectName);
expect(
tree.read(path.join('libs', testProjectName, 'code-pushup.config.ts')),
).toBeNull();
expect(loggerInfoSpy).toHaveBeenCalledWith('Skip config file creation');
});
it('should skip formatting', async () => {
await configurationGenerator(tree, {
project: testProjectName,
skipFormat: true,
});
expect(loggerInfoSpy).toHaveBeenCalledWith('Skip formatting files');
});
});