-
-
Notifications
You must be signed in to change notification settings - Fork 928
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
fix: keep scope when using schema.preceedingPlugins
#2455
Conversation
lib/testUtils/createRuleTester.js
Outdated
@@ -160,7 +160,7 @@ function processGroup(rule, schema, equalityCheck) { | |||
processor.use(assignDisabledRanges) | |||
|
|||
if (schema.preceedingPlugins) { | |||
schema.preceedingPlugins.forEach(processor.use) | |||
schema.preceedingPlugins.forEach(processor.use.bind(processor)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can also make this a schema.preceedingPlugins.forEach(plugin => processor.use(plugin))
if that's favorable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that: it fits the code conventions better.
lib/testUtils/createRuleTester.js
Outdated
@@ -160,7 +160,7 @@ function processGroup(rule, schema, equalityCheck) { | |||
processor.use(assignDisabledRanges) | |||
|
|||
if (schema.preceedingPlugins) { | |||
schema.preceedingPlugins.forEach(processor.use) | |||
schema.preceedingPlugins.forEach(processor.use.bind(processor)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that: it fits the code conventions better.
const createRuleTester = require("../createRuleTester") | ||
|
||
describe("createRuleTester", () => { | ||
it("is possible to create a tester", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea to add tests like this! My one reservation is that the one test covers several different possibilities. It was possible to create a tester before, right? — just not with preceedingPlugins
? Maybe that means there should be a couple of separate tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can split them up. I just seem to have been the first that ever introduced a test for createRuleTester
and the guidelines said to provide a test that exemplifies the issue ;) Happy to add another one before, they are quite verbose however as it pretty much uses the whole stylelint suite, but I agree it would be good to have them.
@davidtheclark changes are in 34f092d, please have another look |
@davidtheclark any chance to get this fix in? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Changelog:
|
awesome, thank you @jeddy3 - any chance to get this in dot-release? |
Sure thing. Patch releases don't take much time. Released in |
Thank you!
…On 2 Apr. 2017 8:55 pm, "Richard Hallows" ***@***.***> wrote:
any chance to get this in dot-release?
Sure thing. Patch releases don't take much time.
Released in 7.10.1.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2455 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALehgeA0TBPSnDsjw1YQSiCuoym6l5Fks5rr36hgaJpZM4Mt7Yr>
.
|
When creating a
ruleTester
, aschema
can be passed in the test setup, e.g.:when using
preceedingPlugins
, this currently fails with:due to the fact that the
.use
method of the postcss processor needs access tothis
.Should be fairly straightforward.