Skip to content

Commit

Permalink
Add a regression test for sass/embedded-host-node#120 (#1784)
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Apr 6, 2022
1 parent 126d17f commit c9a980f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions js-api-spec/legacy/importer.test.ts
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

0 comments on commit c9a980f

Please sign in to comment.