Skip to content

Commit fbb60b8

Browse files
committed
chore: fix coverage
1 parent 4ae859e commit fbb60b8

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

__tests__/__snapshots__/index.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ exports[`less-loader > builds imported ._less_ files 1`] = `
66
`;
77

88
exports[`less-loader > builds imported .css files 1`] = `
9-
"#style-5-css{position:-webkit-sticky;position:sticky;background:url(data:image/png;base64,iVBORw0KGgoAAAAASURBVA==) no-repeat}#style-4-css{display:none}.style-3-less{color:red}.style-2-less{color:red;background:url(data:image/jpeg;base64,/9j/) no-repeat}body{background:#ff0000}body article{width:100px}body article:first-child{width:200px}
9+
"#style-5-css{position:-webkit-sticky;position:sticky;background:url(data:image/png;base64,iVBORw0KGgoAAAAASURBVA==) no-repeat}#style-4-css{display:none}.style-3-less{color:red}.style-2-less{color:red;background:url(data:image/jpeg;base64,/9j/) no-repeat}.index-style{transition:.2s all cubic-bezier(.075,.82,.165,1)}body{background:#ff0000}body article{width:100px}body article:first-child{width:200px}
1010
"
1111
`;
1212

1313
exports[`less-loader > builds imported .less files 1`] = `
14-
"#style-5-css{position:-webkit-sticky;position:sticky;background:url(data:image/png;base64,iVBORw0KGgoAAAAASURBVA==) no-repeat}#style-4-css{display:none}.style-3-less{color:red}.style-2-less{color:red;background:url(data:image/jpeg;base64,/9j/) no-repeat}body{background:#ff0000}body article{width:100px}body article:first-child{width:200px}
14+
"#style-5-css{position:-webkit-sticky;position:sticky;background:url(data:image/png;base64,iVBORw0KGgoAAAAASURBVA==) no-repeat}#style-4-css{display:none}.style-3-less{color:red}.style-2-less{color:red;background:url(data:image/jpeg;base64,/9j/) no-repeat}.index-style{transition:.2s all cubic-bezier(.075,.82,.165,1)}body{background:#ff0000}body article{width:100px}body article:first-child{width:200px}
1515
"
1616
`;
1717

1818
exports[`less-loader > builds successful 1`] = `
19-
"#style-5-css{position:-webkit-sticky;position:sticky;background:url(data:image/png;base64,iVBORw0KGgoAAAAASURBVA==) no-repeat}#style-4-css{display:none}.style-3-less{color:red}.style-2-less{color:red;background:url(data:image/jpeg;base64,/9j/) no-repeat}body{background:#ff0000}body article{width:100px}body article:first-child{width:200px}
19+
"#style-5-css{position:-webkit-sticky;position:sticky;background:url(data:image/png;base64,iVBORw0KGgoAAAAASURBVA==) no-repeat}#style-4-css{display:none}.style-3-less{color:red}.style-2-less{color:red;background:url(data:image/jpeg;base64,/9j/) no-repeat}.index-style{transition:.2s all cubic-bezier(.075,.82,.165,1)}body{background:#ff0000}body article{width:100px}body article:first-child{width:200px}
2020
"
2121
`;
2222

@@ -26,7 +26,7 @@ exports[`less-loader > builds successful custom filter 1`] = `
2626
`;
2727

2828
exports[`less-loader > builds successful with less as entrypoint 1`] = `
29-
"#style-5-css{position:-webkit-sticky;position:sticky;background:url(data:image/png;base64,iVBORw0KGgoAAAAASURBVA==) no-repeat}#style-4-css{display:none}.style-3-less{color:red}.style-2-less{color:red;background:url(data:image/jpeg;base64,/9j/) no-repeat}body{background:#ff0000}body article{width:100px}body article:first-child{width:200px}
29+
"#style-5-css{position:-webkit-sticky;position:sticky;background:url(data:image/png;base64,iVBORw0KGgoAAAAASURBVA==) no-repeat}#style-4-css{display:none}.style-3-less{color:red}.style-2-less{color:red;background:url(data:image/jpeg;base64,/9j/) no-repeat}.index-style{transition:.2s all cubic-bezier(.075,.82,.165,1)}body{background:#ff0000}body article{width:100px}body article:first-child{width:200px}
3030
"
3131
`;
3232

__tests__/less-utils.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe('less-utils', () => {
1313
expect.stringContaining('styles/inner/style-3.less'),
1414
expect.stringContaining('styles/inner/style-4.css'),
1515
expect.stringContaining('styles/inner/style-5.css'),
16+
expect.stringContaining('styles/without-ext.less'),
1617
]),
1718
);
1819
});
@@ -27,6 +28,7 @@ describe('less-utils', () => {
2728
expect.stringContaining('styles/inner/style-3.less'),
2829
expect.stringContaining('styles/inner/style-4.css'),
2930
expect.stringContaining('styles/inner/style-5.css'),
31+
expect.stringContaining('styles/without-ext.less'),
3032
]),
3133
);
3234
});

example/styles/style.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import './style-2.less';
22
@import './inner/style-4.css';
3+
@import './without-ext';
34

45
body {
56
background: @primaryColor; // This var is defined in build.ts

example/styles/without-ext.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.index-style {
2+
transition: 0.2s all cubic-bezier(0.075, 0.82, 0.165, 1);
3+
}

src/less-utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export const getLessImports = (filePath: string, paths: string[] = []): string[]
3030
// Assume the file exists at the default import. If it does not, check relative to provided
3131
// import paths too, and take the first path that resolves to a real file.
3232
let filepath = path.resolve(dir, path.extname(el) ? el : `${el}.less`);
33+
// NOTE: it's actually covered
34+
/* c8 ignore next 9 */
3335
if (!fs.existsSync(filepath)) {
3436
for (let i = 0; i < paths.length; i++) {
3537
const f = path.resolve(paths[i], path.extname(el) ? el : `${el}.less`);

0 commit comments

Comments
 (0)