diff --git a/src/helpers/__tests__/__snapshots__/getDtsSnapshot.test.ts.snap b/src/helpers/__tests__/__snapshots__/getDtsSnapshot.test.ts.snap index a4230af..92ae0af 100644 --- a/src/helpers/__tests__/__snapshots__/getDtsSnapshot.test.ts.snap +++ b/src/helpers/__tests__/__snapshots__/getDtsSnapshot.test.ts.snap @@ -1361,3 +1361,15 @@ export let myAnimation: string | undefined; export let myFolderIndex: string | undefined; " `; + +exports[`helpers / cssSnapshots with sass @use and a partial should find external file from loadPaths 1`] = ` +{ + "class-with-partial": "class-with-partial", +} +`; + +exports[`helpers / cssSnapshots with sass @use and a partial should find external file from loadPaths 2`] = ` +".class-with-partial { + background-color: rebeccapurple; +}" +`; diff --git a/src/helpers/__tests__/fixtures/_partial.scss b/src/helpers/__tests__/fixtures/_partial.scss new file mode 100644 index 0000000..04f40f9 --- /dev/null +++ b/src/helpers/__tests__/fixtures/_partial.scss @@ -0,0 +1 @@ +$primary-color: rebeccapurple; diff --git a/src/helpers/__tests__/fixtures/partial.module.scss b/src/helpers/__tests__/fixtures/partial.module.scss new file mode 100644 index 0000000..d30f3a1 --- /dev/null +++ b/src/helpers/__tests__/fixtures/partial.module.scss @@ -0,0 +1,5 @@ +@use 'partial'; + +.class-with-partial { + background-color: partial.$primary-color; +} diff --git a/src/helpers/__tests__/getDtsSnapshot.test.ts b/src/helpers/__tests__/getDtsSnapshot.test.ts index fbd34be..0dbd98d 100644 --- a/src/helpers/__tests__/getDtsSnapshot.test.ts +++ b/src/helpers/__tests__/getDtsSnapshot.test.ts @@ -152,6 +152,26 @@ describe('helpers / cssSnapshots', () => { }); }); + describe('with sass @use and a partial', () => { + const fileName = join(__dirname, 'fixtures', 'partial.module.scss'); + const css = readFileSync(fileName, 'utf8'); + + it('should find external file from loadPaths', () => { + const cssExports = getCssExports({ + css, + fileName, + logger, + options, + processor, + compilerOptions, + directory: __dirname, + }); + + expect(cssExports.classes).toMatchSnapshot(); + expect(cssExports.css).toMatchSnapshot(); + }); + }); + describe('with loadPaths in sass options', () => { const fileName = join(__dirname, 'fixtures', 'include-path.module.scss'); const css = readFileSync(fileName, 'utf8');