-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 watch mode to tests #1748
Add watch mode to tests #1748
Conversation
@@ -32,6 +32,7 @@ | |||
"postinstall": "node scripts/build.js", | |||
"lint": "node_modules/.bin/eslint bin/node-sass lib scripts test", | |||
"test": "node_modules/.bin/mocha test", | |||
"test-watch": "node_modules/.bin/mocha test -w", |
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.
Please remove this. You can already do this with npm.
npm test -- -w
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.
you're right, I've removed that
After a test run the process variables did always return test values, because getters in javascript have a higher precedence than the actual value.
ea0c034
to
9bbff57
Compare
@xzyfer Sorry for not getting back any sooner. Upon revising this PR it turns out that getters are actually not needed at all and you can set the value of a property directly with |
|
||
describe('binding', function() { | ||
beforeEach(function() { | ||
delete require.cache[sassPath]; |
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.
I think @xzyfer removed this stuff in a recent PR, so I'll let him go through this again
Thanks @marvinhagemeister I've update the |
The state leakage means that running mocha in watch mode causes random failures. Closes sass#1748
@xzyfer The committed fix is incomplete. The leakage happens because $ node
> process.platform
'darwin'
> process.platform = "whatever"
'whatever'
> process.platform
'darwin'
> Non writable properties can only be overwritten with Object.defineProperty(process, 'platform', {
value: "whatever",
}); I've rebased the PR against master, but lack the permissions to reopen it. |
Apologies the diff nor the comments were clear on what the issue actually was. Rebasing wont work since these specs have been moved out of api.js into binding.js. Please create a new PR with the fixes on the correct specs. |
Implement variable shadow scoping
This also fixes process variables like
process.platform
not being properly restored after a test run because getters have a higher precedence.Tested on both
v0.12.0
andv6.7.0
.