-
Notifications
You must be signed in to change notification settings - Fork 61
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
getConfig will assign default options to generated config #429
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,12 @@ | |
* lets pull in what we're testing here | ||
*/ | ||
|
||
var fs = require( 'fs' ) | ||
var assert = require( 'assert' ) | ||
require( 'chai' ).should() // add should assertions on top | ||
var chokidar = require( 'chokidar' ) | ||
var touch = require( 'touch' ) | ||
var sinon = require( 'sinon' ) | ||
var app = require( '../index' )().create() | ||
var stripJsonComments = require( 'strip-json-comments' ) | ||
|
||
// turn on strict mode from this point and turn off unnecessary logging | ||
app.state.quiet = true | ||
|
@@ -387,10 +385,14 @@ describe( 'Utility Methods: ', function() { | |
process.argv[2] = '-c' | ||
process.argv[3] = '.stylintrc' | ||
var testMethod = app.setConfig( '.stylintrc' ) | ||
var testConfig = JSON.parse( stripJsonComments( fs.readFileSync( process.cwd() + '/.stylintrc', 'utf-8' ) ) ) | ||
var testConfig = app.setConfig( process.cwd() + '/.stylintrc' ) | ||
|
||
it( 'return complete config when not complete config is passed in', function() { | ||
assert.ok( testConfig.reporter ) | ||
} ) | ||
|
||
it( 'update config state if passed a valid path', function() { | ||
assert.deepEqual( testMethod, testConfig ) | ||
assert.equal( Object.keys( testConfig ).length, Object.keys( testMethod ).length ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we changing this test? If we must change this, we should still check for deep equality between two objects since doing key comparisons can lead to false positives. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trying to remember this one.. 😣 I think I changed it since the important part is that they should contain the same amount of options now, not the exact same values since they may vary. I'll try to dig out my old notes. |
||
} ) | ||
|
||
it( 'throw if passed invalid path', function() { | ||
|
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.
Nice test! Can we paraphrase a bit to avoid ambiguity with what
complete
means here?Perhaps something like:
What do you think?
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.
Sounds good, I'll update the PR. Thnx.