@emulsify/core 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/webpack/loaders.js +29 -15
- package/config/webpack/plugins.js +183 -36
- package/config/webpack/resolves.js +110 -44
- package/config/webpack/webpack.common.js +197 -156
- package/config/webpack/webpack.dev.js +2 -1
- package/package.json +7 -7
- package/scripts/a11y.js +83 -23
- package/scripts/a11y.test.js +51 -38
package/scripts/a11y.test.js
CHANGED
|
@@ -31,7 +31,9 @@ describe('a11y', () => {
|
|
|
31
31
|
global.console.log.mockClear();
|
|
32
32
|
global.process.exit.mockClear();
|
|
33
33
|
});
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
it('maps axe issue severity to a label', () => {
|
|
36
|
+
// (Name no longer mentions "chalk")
|
|
35
37
|
expect.assertions(3);
|
|
36
38
|
expect(severityToColor('error')).toBe('red');
|
|
37
39
|
expect(severityToColor('warning')).toBe('yellow');
|
|
@@ -56,7 +58,7 @@ describe('a11y', () => {
|
|
|
56
58
|
expect(issueIsValid({ code: 'chicken', runnerExtras: {} })).toBe(true);
|
|
57
59
|
});
|
|
58
60
|
|
|
59
|
-
it('
|
|
61
|
+
it('logs a single issue without color codes', () => {
|
|
60
62
|
expect.assertions(1);
|
|
61
63
|
logIssue({
|
|
62
64
|
type: 'error',
|
|
@@ -65,16 +67,16 @@ describe('a11y', () => {
|
|
|
65
67
|
selector: 'kfc > popeyes > .chicken',
|
|
66
68
|
});
|
|
67
69
|
expect(global.console.log.mock.calls[0][0]).toMatchInlineSnapshot(`
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
"
|
|
71
|
+
severity: error
|
|
72
|
+
message: this chicken is not fried enough.
|
|
73
|
+
context: https://example.com
|
|
74
|
+
selector: kfc > popeyes > .chicken
|
|
75
|
+
"
|
|
76
|
+
`);
|
|
75
77
|
});
|
|
76
78
|
|
|
77
|
-
it('
|
|
79
|
+
it('logs a whole report without color codes', () => {
|
|
78
80
|
const report = {
|
|
79
81
|
issues: [
|
|
80
82
|
{
|
|
@@ -96,45 +98,56 @@ describe('a11y', () => {
|
|
|
96
98
|
};
|
|
97
99
|
expect(logReport(report)).toBe(true);
|
|
98
100
|
expect(global.console.log.mock.calls).toMatchInlineSnapshot(`
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
101
|
+
Array [
|
|
102
|
+
Array [
|
|
103
|
+
"Issues found in component: https://example/component.html",
|
|
104
|
+
],
|
|
105
|
+
Array [
|
|
106
|
+
"
|
|
107
|
+
severity: error
|
|
108
|
+
message: this pizza is too soggy
|
|
109
|
+
context: https://example.com
|
|
110
|
+
selector: pizza > .hut
|
|
111
|
+
",
|
|
112
|
+
],
|
|
113
|
+
Array [
|
|
114
|
+
"
|
|
115
|
+
severity: error
|
|
116
|
+
message: this pasta is undercooked
|
|
117
|
+
context: https://example.com
|
|
118
|
+
selector: olive > .garden
|
|
119
|
+
",
|
|
120
|
+
],
|
|
121
|
+
]
|
|
122
|
+
`);
|
|
121
123
|
});
|
|
122
124
|
|
|
123
|
-
it('logs
|
|
125
|
+
it('logs that a component has no issues when a report is empty', () => {
|
|
124
126
|
expect(logReport({ issues: [], pageUrl: 'papa-johns' })).toBe(false);
|
|
125
127
|
expect(global.console.log.mock.calls[0][0]).toMatchInlineSnapshot(
|
|
126
|
-
`"
|
|
128
|
+
`"No issues found in component: papa-johns"`,
|
|
127
129
|
);
|
|
128
130
|
});
|
|
129
131
|
|
|
130
|
-
it('
|
|
131
|
-
expect.assertions(
|
|
132
|
+
it('calls pa11y with the full path to a component', async () => {
|
|
133
|
+
expect.assertions(3);
|
|
132
134
|
await expect(lintComponent('chicken-strips')).resolves.toBe(
|
|
133
135
|
'very official report',
|
|
134
136
|
);
|
|
135
|
-
|
|
137
|
+
|
|
138
|
+
// First arg: URL
|
|
139
|
+
expect(pa11y.mock.calls[0][0]).toBe(
|
|
136
140
|
`${STORYBOOK_IFRAME}?id=chicken-strips`,
|
|
137
|
-
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
// Second arg: options merged with defaults in a11y.js
|
|
144
|
+
expect(pa11y.mock.calls[0][1]).toEqual(
|
|
145
|
+
expect.objectContaining({
|
|
146
|
+
includeNotices: true,
|
|
147
|
+
includeWarnings: true,
|
|
148
|
+
runners: ['axe'],
|
|
149
|
+
...pa11yConfig,
|
|
150
|
+
}),
|
|
138
151
|
);
|
|
139
152
|
});
|
|
140
153
|
|