Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: support import index file from package #649

Merged
merged 1 commit into from Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/index.test.js
Expand Up @@ -171,6 +171,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