Skip to content

Commit

Permalink
test: support import index file from package (#649)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Dec 14, 2018
1 parent aa64e1b commit 2d6045b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/index.test.js
Expand Up @@ -173,6 +173,11 @@ implementations.forEach((implementation) => {
));
it('should resolve sass field correctly', () =>
execTest(`import-sass-field`));
// Works only in dart-sass implementation
if (implementation === dartSass) {
it('should resolve index file in module correctly', () =>
execTest('import-index'));
}
});
describe('custom importers', () => {
it('should use custom importer', () =>
Expand Down
2 changes: 2 additions & 0 deletions test/node_modules/sass-package-with-index/index.sass

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions test/node_modules/scss-package-with-index/index.scss

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/sass/import-index.sass
@@ -0,0 +1 @@
@import "~sass-package-with-index"
1 change: 1 addition & 0 deletions test/scss/import-index.scss
@@ -0,0 +1 @@
@import "~scss-package-with-index";
7 changes: 7 additions & 0 deletions test/tools/createSpec.js
Expand Up @@ -113,6 +113,13 @@ function createSpec(ext) {
return;
}

if (fileWithoutExt === 'import-index' && implementation !== dartSass) {
// Skip CSS imports for all implementations that are not node-sass
// CSS imports is a legacy feature that we only support for node-sass
// See discussion https://github.com/webpack-contrib/sass-loader/pull/573/files?#r199109203
return;
}

sassOptions.functions = customFunctions(implementation);

const [name] = implementation.info.split('\t');
Expand Down

0 comments on commit 2d6045b

Please sign in to comment.