-
Notifications
You must be signed in to change notification settings - Fork 798
/
Copy pathvalidate-custom.spec.ts
49 lines (45 loc) · 1.5 KB
/
validate-custom.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
45
46
47
48
49
import type * as d from '@stencil/core/declarations';
import { mockConfig, mockLoadConfigInit } from '@stencil/core/testing';
import { buildWarn } from '@utils';
import { validateConfig } from '../validate-config';
describe('validateCustom', () => {
let userConfig: d.Config;
beforeEach(() => {
userConfig = mockConfig();
});
it('should log warning', () => {
userConfig.outputTargets = [
{
type: 'custom',
name: 'test',
validate: (_, diagnostics) => {
const warn = buildWarn(diagnostics);
warn.messageText = 'test warning';
},
generator: async () => {
return;
},
},
];
const { diagnostics } = validateConfig(userConfig, mockLoadConfigInit());
// TODO(STENCIL-1107): Decrement the right-hand side value from 2 to 1
expect(diagnostics.length).toBe(2);
// TODO(STENCIL-1107): Keep this assertion
expect(diagnostics[0]).toEqual({
header: 'Build Warn',
level: 'warn',
lines: [],
messageText: 'test warning',
type: 'build',
});
// TODO(STENCIL-1107): Remove this assertion
expect(diagnostics[1]).toEqual({
header: 'Build Warn',
level: 'warn',
lines: [],
messageText:
'nodeResolve.customResolveOptions is a deprecated option in a Stencil Configuration file. If you need this option, please open a new issue in the Stencil repository (https://github.com/ionic-team/stencil/issues/new/choose)',
type: 'build',
});
});
});