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 ‘renderMethod’ option for runSass()` to support async custom importer - fix #35 #148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yoannisj
Copy link

@yoannisj yoannisj commented Jun 6, 2019

This PR addresses issue #35, where the usage of a custom importer that is relying on the use of sass's async render method throws a 'done is not a function' error.

The error only gets thrown after the stylesheets get rendered, and sass is done with all the sass-true tests, which mean you'd still get the general stats messages (output by sass-true with @debug, and listing how many tests were run, how many failed and how many passed).

Screen Shot 2019-06-06 at 21 13 58

The edits in this PR provide a renderMethod option for sassTrue.runSass which can be set to 'render', in which case sass's render() method will be used to run the tests (instead of renderSync). This prevents the 'done is not a function' error to be thrown, but fails to show the detailed report for which tests pass and which don't (as a matter of fact, it shows '0 passed' at the beginning). The @debug stats messages are still shown at the end, and return the correct numbers.

Screen Shot 2019-06-06 at 21 16 00

I suspect this to be because sass-true doesn't wait for the asynchronous sass rendering to show the results. Maybe this is an easy fix, and you can include it in this PR?

PS: I realise the actual issue here is coming from node-sass, but it seems like it's not going to be solved before they release v5.0.0. In the meantime, I tried to improve the support for custom importers in sass-true, and thought I'd share.

@coveralls
Copy link

coveralls commented Jun 6, 2019

Pull Request Test Coverage Report for Build 456

  • 5 of 8 (62.5%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.5%) to 98.522%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/main.js 5 8 62.5%
Totals Coverage Status
Change from base Build 454: -1.5%
Covered Lines: 296
Relevant Lines: 299

💛 - Coveralls

Copy link
Member

@jgerigmeyer jgerigmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fleshing out this workaround! I'm glad if it reduces errors and points others in the right direction, but it really feels a bit like a hack without adding full async reporting support to True. I'm on board with a PR documenting this workaround in the meantime, or a PR adding async support -- but I don't personally think this should be merged as-is.

}
);
};
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test needs an assertion to be useful.

"integrity": "sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk=",
"dev": true,
"requires": {
"node-in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be removed from the PR.

@jgerigmeyer jgerigmeyer changed the base branch from master to main July 17, 2020 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants