Skip to content

Commit 9280f22

Browse files
committed
chore(ci): cleanup unused references and improve ci logging
- Changed DRY_RUN to be configurable via environment variable. - Introduced PLACEHOLDER_VERSION for versioning consistency. - Simplified console log handling in various Vite configurations by extracting logic into a dedicated function. - Removed unused imports and improved button example interactions in the documentation. - Fixed typos in test descriptions for better clarity. Signed-off-by: Cory Rylan <crylan@nvidia.com>
1 parent 31730e8 commit 9280f22

22 files changed

Lines changed: 60 additions & 54 deletions

File tree

projects/code/vitest.config.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ export default mergeConfig(libraryTestConfig, {
2222
'highlight.js/lib/languages/typescript',
2323
'highlight.js/lib/languages/xml',
2424
'highlight.js/lib/languages/yaml'
25-
],
26-
rolldownOptions: {
27-
mainFields: ['module', 'main']
28-
}
25+
]
2926
},
3027
test: {
3128
include: ['./src/**/*.test.ts'],

projects/core/src/button/button.examples.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ export default {
1313
component: 'nve-button'
1414
};
1515

16-
declare const __ELEMENTS_REPO_BASE_URL__: string;
17-
1816
/**
1917
* @summary Basic button component with standard appearance and behavior for primary user actions.
2018
*/
@@ -120,20 +118,25 @@ export const Disabled = {
120118
*/
121119
export const InvokerCommand = {
122120
render: () => html`
123-
<img id="logo" src="${__ELEMENTS_REPO_BASE_URL__}/favicon.svg" alt="logo" style="width: 100px; height: 100px;" />
121+
<nve-icon
122+
id="rotation-target"
123+
name="sparkles"
124+
aria-label="sparkles icon"
125+
style="inline-size: 100px; block-size: 100px;"
126+
></nve-icon>
124127
<section>
125-
<nve-button commandfor="logo" command="--rotate-left">Rotate left</nve-button>
126-
<nve-button commandfor="logo" command="--rotate-right">Rotate right</nve-button>
128+
<nve-button commandfor="rotation-target" command="--rotate-left">Rotate left</nve-button>
129+
<nve-button commandfor="rotation-target" command="--rotate-right">Rotate right</nve-button>
127130
<nve-button commandfor="popover" command="toggle-popover">toggle-popover</nve-button>
128131
</section>
129132
<nve-toggletip id="popover">popover</nve-toggletip>
130133
<script type="module">
131-
const logo = document.getElementById('logo');
132-
logo.addEventListener('command', (event) => {
133-
if (event.command == '--rotate-left') {
134-
logo.style.rotate = '-90deg';
135-
} else if (event.command == '--rotate-right') {
136-
logo.style.rotate = '90deg';
134+
const target = document.getElementById('rotation-target');
135+
target.addEventListener('command', (event) => {
136+
if (event.command === '--rotate-left') {
137+
target.style.rotate = '-90deg';
138+
} else if (event.command === '--rotate-right') {
139+
target.style.rotate = '90deg';
137140
}
138141
});
139142
</script>

projects/core/src/internal/base/button.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ describe('base button', () => {
233233
expect((await event).type).toBe('submit');
234234
});
235235

236-
it('should not ineract with form elements if type button', async () => {
236+
it('should not interact with form elements if type button', async () => {
237237
submitButtonInForm.type = 'button';
238238
await elementIsStable(submitButtonInForm);
239239
const o = { f: () => null };
@@ -273,7 +273,7 @@ describe('base button', () => {
273273
expect(o.f).not.toHaveBeenCalled();
274274
});
275275

276-
it('should not interact with form elements if disabeld', async () => {
276+
it('should not interact with form elements if disabled', async () => {
277277
submitButtonInForm.disabled = true;
278278
await elementIsStable(submitButtonInForm);
279279

projects/core/src/internal/controllers/state-current.controller.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('state-current.controller', () => {
7676
expect(element.matches(':state(current)')).toBe(false);
7777
});
7878

79-
it('should appply aria-current="page" if a current anchor', async () => {
79+
it('should apply aria-current="page" if a current anchor', async () => {
8080
const a = document.createElement('a');
8181
a.href = '#';
8282
element.appendChild(a);

projects/core/src/internal/controllers/state-selected.controller.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('state-selected.controller', () => {
7676
expect(element.matches(':state(selected)')).toBe(false);
7777
});
7878

79-
it('should appply aria-current="page" if a selected anchor', async () => {
79+
it('should apply aria-current="page" if a selected anchor', async () => {
8080
const a = document.createElement('a');
8181
a.href = '#';
8282
element.appendChild(a);

projects/core/src/internal/controllers/type-submit.controller.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ describe('type-submit.controller', () => {
166166
expect((await event).type).toBe('reset');
167167
});
168168

169-
it('should not ineract with form elements if type button', async () => {
169+
it('should not interact with form elements if type button', async () => {
170170
submitButtonInForm.type = 'button';
171171
await elementIsStable(submitButtonInForm);
172172
const o = { f: () => null };

projects/internals/ci/cache-validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async function validateCache(task) {
1919
const parallel = process.env.WIREIT_PARALLEL ? ` WIREIT_PARALLEL=${process.env.WIREIT_PARALLEL}` : '';
2020
// Only pass PAGES_BASE_URL when set so Wireit sees same env as first run (default "/elements/" for site:build)
2121
const pagesBaseUrl = process.env.PAGES_BASE_URL !== undefined ? ` PAGES_BASE_URL=${process.env.PAGES_BASE_URL}` : '';
22-
const { stdout } = await new Promise(resolve =>
22+
await new Promise(resolve =>
2323
exec(
2424
`WIREIT_DEBUG_LOG_FILE=.wireit-cache WIREIT_LOGGER=simple${pagesBaseUrl}${parallel} pnpm run ${task}`,
2525
(stderr, stdout) => resolve({ stdout, stderr })

projects/internals/vite/src/configs/axe.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import process from 'process';
33
import { readFileSync } from 'node:fs';
44
import { resolve } from 'node:path';
55
import { playwright } from '@vitest/browser-playwright';
6+
import { hideExpectedTestConsoleMessage } from './console.js';
67

78
const watch = process.argv.findIndex(i => i === '--watch') !== -1;
89
const coverage = process.argv.findIndex(i => i === '--coverage') !== -1;
@@ -69,13 +70,7 @@ export const libraryAxeTestConfig = {
6970
junit: './coverage/axe/junit.xml',
7071
json: './coverage/axe/summary.json'
7172
},
72-
onConsoleLog(log) {
73-
if (log.includes('scheduled an update')) return false;
74-
if (log.includes('Lit is in dev mode')) return false;
75-
if (log.includes('@nve: ')) return false;
76-
if (log.startsWith('[Error: Expected error]')) return false;
77-
if (log.startsWith('Ignored')) return false;
78-
},
73+
onConsoleLog: hideExpectedTestConsoleMessage,
7974
setupFiles: ['@internals/vite/setup/axe.js'], // todo: this should be project specific
8075
browser: {
8176
isolate: false,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const expectedTestConsoleMessages = [
2+
'plugin vite-plugin-virtual-html',
3+
'ElementInternals.checkValidity() was called on the server.This method always returns true.'
4+
];
5+
6+
function isExpectedTestConsoleMessage(log) {
7+
if (expectedTestConsoleMessages.some(message => log.includes(message))) {
8+
return true;
9+
}
10+
11+
return false;
12+
}
13+
14+
export function hideExpectedTestConsoleMessage(log) {
15+
if (isExpectedTestConsoleMessage(log)) {
16+
return false;
17+
}
18+
}

projects/internals/vite/src/configs/lighthouse.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import process from 'process';
1+
import { hideExpectedTestConsoleMessage } from './console.js';
22

33
/** @type {import('vite').UserConfig} */
44
export const libraryLighthouseTestConfig = {
@@ -9,11 +9,7 @@ export const libraryLighthouseTestConfig = {
99
isolate: false,
1010
maxWorkers: 1,
1111
fileParallelism: false,
12-
onConsoleLog(log) {
13-
if (log.includes('plugin vite-plugin-virtual-html')) {
14-
return false;
15-
}
16-
},
12+
onConsoleLog: hideExpectedTestConsoleMessage,
1713
reporters: [
1814
'default',
1915
'junit',

0 commit comments

Comments
 (0)