From 97adf1b2082f76bebe282f09ac6664669c49a3ff Mon Sep 17 00:00:00 2001 From: Bram Gotink Date: Tue, 1 Dec 2020 18:15:23 +0100 Subject: [PATCH] feat: add fixture that fails to resolve to _index.import.scss --- test/loader.test.js | 16 ++++++++++++++++ test/node_modules/only-import/_index.import.scss | 3 +++ test/node_modules/only-import/package.json | 11 +++++++++++ test/sass/only-import.sass | 1 + test/scss/only-import.scss | 1 + 5 files changed, 32 insertions(+) create mode 100644 test/node_modules/only-import/_index.import.scss create mode 100644 test/node_modules/only-import/package.json create mode 100644 test/sass/only-import.sass create mode 100644 test/scss/only-import.scss diff --git a/test/loader.test.js b/test/loader.test.js index ebc3cd4f..758ea3fa 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -1454,6 +1454,22 @@ describe("loader", () => { expect(getWarnings(stats)).toMatchSnapshot("warnings"); expect(getErrors(stats)).toMatchSnapshot("errors"); }); + + it(`should import .import.${syntax} files without .${syntax} file next to it (${implementationName}) (${syntax})`, async () => { + const testId = getTestId("only-import", syntax); + const options = { + implementation: getImplementationByName(implementationName), + }; + const compiler = getCompiler(testId, { loader: { options } }); + const stats = await compile(compiler); + const codeFromBundle = getCodeFromBundle(stats, compiler); + const codeFromSass = getCodeFromSass(testId, options); + + expect(codeFromBundle.css).toBe(codeFromSass.css); + expect(codeFromBundle.css).toMatchSnapshot("css"); + expect(getWarnings(stats)).toMatchSnapshot("warnings"); + expect(getErrors(stats)).toMatchSnapshot("errors"); + }); } }); }); diff --git a/test/node_modules/only-import/_index.import.scss b/test/node_modules/only-import/_index.import.scss new file mode 100644 index 00000000..d1308905 --- /dev/null +++ b/test/node_modules/only-import/_index.import.scss @@ -0,0 +1,3 @@ +a { + display: block; +} diff --git a/test/node_modules/only-import/package.json b/test/node_modules/only-import/package.json new file mode 100644 index 00000000..9988c74e --- /dev/null +++ b/test/node_modules/only-import/package.json @@ -0,0 +1,11 @@ +{ + "name": "only-import", + "version": "1.0.0", + "description": "test", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "MIT" +} diff --git a/test/sass/only-import.sass b/test/sass/only-import.sass new file mode 100644 index 00000000..10428ec0 --- /dev/null +++ b/test/sass/only-import.sass @@ -0,0 +1 @@ +@import '~only-import' diff --git a/test/scss/only-import.scss b/test/scss/only-import.scss new file mode 100644 index 00000000..fe2dbdab --- /dev/null +++ b/test/scss/only-import.scss @@ -0,0 +1 @@ +@import '~only-import';