-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
init.spec.ts
44 lines (35 loc) · 1.17 KB
/
init.spec.ts
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
import { Linter } from '../utils/linter';
import { Tree } from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { lintInitGenerator } from './init';
describe('@nrwl/linter:init', () => {
let tree: Tree;
beforeEach(() => {
tree = createTreeWithEmptyWorkspace();
});
describe('--linter', () => {
describe('eslint', () => {
it('should generate the global eslint config', async () => {
await lintInitGenerator(tree, {
linter: Linter.EsLint,
});
expect(tree.read('.eslintrc.json', 'utf-8')).toMatchSnapshot();
});
it('should not generate the global eslint config if it already exist', async () => {
tree.write('.eslintrc.js', '{}');
await lintInitGenerator(tree, {
linter: Linter.EsLint,
});
expect(tree.exists('.eslintrc.json')).toBe(false);
});
});
describe('tslint', () => {
it('should generate the global tslint config', async () => {
await lintInitGenerator(tree, {
linter: Linter.TsLint,
});
expect(tree.read('tslint.json', 'utf-8')).toMatchSnapshot();
});
});
});
});