Skip to content

Commit

Permalink
Add a regression test for sass/embedded-host-node#120
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Apr 6, 2022
1 parent 126d17f commit f15e2a7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 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,27 @@ 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 f15e2a7

Please sign in to comment.