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

Add a regression test for sass/embedded-host-node#120 #1784

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions js-api-spec/legacy/importer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,29 @@ describe('the previous URL', () => {
expect(importer1).toHaveBeenCalledTimes(2);
expect(importer2).toHaveBeenCalled();
});

// Regression test for sass/embedded-host-node#120
it('is passed after a relative import', () =>
sandbox(dir => {
dir.write({
'test.scss': `
@import "relative";
@import "importer";
`,
'_relative.scss': 'a {b: relative}',
});

const importer = jest.fn((url, prev) => {
expect(url).toBe('importer');
expect(prev).toBe(dir('test.scss'));
return {contents: 'a {b: importer}'};
});

expect(
sass.renderSync({file: dir('test.scss'), importer}).css.toString()
).toEqualIgnoringWhitespace('a { b: relative; } a { b: importer; }');
expect(importer).toHaveBeenCalledTimes(1);
}));
});

describe('this', () => {
Expand Down