Commit graph

108 commits

Author SHA1 Message Date
louis-murray
391665cc38 Enable writes env and argv stores with a flag (#285)
* added fucntionality to toggle readonly for env store

* fixed issue with using lint

* updated readme to reflect env options change

* updated tests to better test readOnly property

* added fucntionality to toggle readonly for env store

* fixed issue with using lint

* updated readme to reflect env options change

* updated tests to better test readOnly property

* updated tests to fix issues.

* updated argv to have readOnly toggle-able

* added tests for argv toggle-able readonly
2017-11-12 23:11:01 -05:00
bryce-gibson
b6699aba2d Don't do array lookups on strings. (#188)
`hasOwnProperty(number)` can return true for strings.

This is unlikely to be the desired usage, and can mean that odd
responses are returned by nconf.

Disable trying to check `hasOwnProperty` of strings.
2017-11-04 21:39:00 -04:00
Adrien Becchis
467ab753c8 Regex as env separator (#288)
* use regexp as env separator (support shorthand specification)

* add test to cover the env separator
2017-11-04 21:30:56 -04:00
Adrien Becchis
e5db2ef6d7 Argv store separator (#291)
* argv store now accept a separator argument to create nested values

* remove stub file that shouldnt have been commited

* write a test to ensure separator is working well and use delete rather than undefined assign
2017-11-04 21:30:14 -04:00
Ahmed Ayoub
3607767f90 fixes #258 chainable .required() (#259)
* fixes #258 chainable .required()

* fixes #258 use var instead of let for travis builds
2017-11-04 00:34:27 -04:00
Adrien Becchis
b9321b200a transformer can now return an undefined key (#289) 2017-11-03 23:22:13 -04:00
Augusto Franzoia
b1ee63cfa4 fix error in transform function when dealing with dropped entries (#287) 2017-10-31 17:12:31 -04:00
Adrien Becchis
b41c505c6e Save conf to dedicated file (#283)
* Added support for saving configuration to a specific file

Added support for saving configuration to a specific file

* add test to cover the save to file feature

* add posibility to specify a format to save to file

* add a test with nconf-yaml to ensure specifying a format works
2017-10-30 10:01:55 -04:00
AdrieanKhisbe
fa215a44f1 add tests for the normal configuration of yargs via argv 2017-10-28 17:13:38 -04:00
AdrieanKhisbe
802a8d623f test for yargs custom instance (more flexible check isYargs) 2017-10-28 17:13:38 -04:00
Matt Hamann
856fdf8dff First pass at transform functions (#279) 2017-10-25 22:57:58 -04:00
Matt Hamann
b9c345bf96 Fix parseValues option name 2017-10-21 21:58:30 -04:00
Matt Hamann
35088a3313 Added nconf.any method (#278)
* Added nconf.any method

Fixes #126
Implemented on the Provider class
Takes an array of keys, or a variable argument list
Supports both callback and non-callback invocations

* Use an explicit search base in file store test

Fixes #224
Test file was created under process.env.HOME, but test was searching in
the current working directory. If the cwd was not on the same drive as
the home directory, the test would fail.

* Added some API documentation to README for 'any'

* Tweak `.any` documentation
2017-10-21 16:42:24 -04:00
Matt Hamann
ca10d0eaf8 Add basic linting rules 2017-10-21 16:01:06 -04:00
Matt Hamann
532ac9cc57 Support parsing simple values from env/argv strings (#273)
* simple parse, indexzero/nconf#72

* documentation for tryParse option

* Combine JSON parsing and simple parsing
2017-10-21 15:39:16 -04:00
Matt Hamann
b8402d4eab Enable support for parsing JSON environment variables (#272)
* Add support for applying JSON string

* only take JSON Object or JSON Array into consideration

* Add tests and make JSON-parsing opt-in
2017-09-27 16:32:26 -04:00
Chris Manson
608b607782 Add test for merging with defaults (#255)
* implementing a test for merging with defaults

* bypassing strange common tests

* trying to fix travis build in node 7

* adding node 8 to tests

* removing node 8
2017-08-15 23:37:19 -04:00
Wojtek Turyn
5d6e236b73 fixed 2015-10-15 10:44:26 +02:00
Wojtek Turyn
37a84ae8df required() method 2015-10-15 10:16:33 +02:00
indexzero
2030144d88 [test dist] Add test/fixtures/secure.json. 2015-09-20 00:36:49 -07:00
indexzero
0358545ae5 [test api] Make the format capable of sub-objects. 2015-09-20 00:26:34 -07:00
indexzero
04c0f3a001 [api test] Encrypt individual keys instead of entire stringified contents. Added basic unit tests. 2015-09-19 00:12:50 -07:00
Jarrett Cruger
394286cd16 Merge pull request #172 from Oza94/fix-child-process-tests
fix random fails on tests that use child process
2015-09-17 18:46:57 -07:00
Jarrett Cruger
54f2287dd8 Merge pull request #177 from olalonde/master
env({lowerCase:true}) option to make it possible to get() keys in lower case
2015-09-17 18:46:27 -07:00
Remy Sharp
3c11ef50e5 fix: env.match test
The previous test was expecting the .match value to be a function rather than a regexp which is what the README shows. So I've fixed the code to match against a real regexp, and test if the stringified version of the regexp function is [object RegExp].

I've also updated the tests to prime the process.env with values that are specifically tested for to ensure it's correctly loading the env values.

Fixex indexzero/nconf#178
2015-08-04 10:30:33 -07:00
Olivier Lalonde
8a21ef36d5 env({lowerCase:true}) option to make it possible to get() keys in lower case 2015-08-04 18:56:43 +08:00
Pierre Beaujeu
339e59afd5 fix random fails on tests that use child process
Listen to 'close' event rather than 'exit' event which can be fired before
stdio is closed.
2015-07-09 17:33:52 +02:00
Christian Murphy
80ec01b91d replace optimist with yargs 2015-07-07 13:06:41 -07:00
Jarrett Cruger
6271cdb35d Revert "fixing the tests"
This reverts commit f69e43a423.
2014-11-26 12:49:50 -05:00
indexzero
af0e9fb7e7 [dist fix] Cleanup some whitespace. 2014-11-26 01:31:48 -05:00
indexzero
09342555ba [fix] Fixed regression introduced by #98. 2014-11-26 01:28:31 -05:00
indexzero
0b8aa903c7 [fix test] Remove leftover console.log() from #79. 2014-11-26 01:05:06 -05:00
Charlie Robbins
c6d8f5d140 Merge pull request #79 from jfromaniello/master
Use optionally a different separator for memorystore
2014-11-26 01:04:35 -05:00
Chris Manson
f69e43a423 fixing the tests 2014-05-27 17:43:24 +01:00
midknight41
6c1eb5e917 fixed white spacing and added (embarrassing absent) variable declarations 2013-10-26 20:40:12 +01:00
midknight41
6641ed234a made bom tests more meaningful 2013-10-03 15:58:13 +01:00
midknight41
2ce8aea8fc made bom tests more meaningful 2013-10-03 15:53:02 +01:00
midknight41
f7733c1719 included bom test fixtures 2013-10-03 14:37:39 +01:00
midknight41
29f1ca281b added support for BOM in load() and loadSync() 2013-10-03 09:17:36 +01:00
Marcin Floryan
ada15db9e3 Test that invalid file name is indicated 2013-04-29 21:36:26 +01:00
José F. Romaniello
039057c730 allow different separator for memorystore 2013-04-05 15:07:33 -03:00
Charlie Robbins
818526ca62 Merge pull request #63 from SchoonologyRRL/patch-1
Updated Memory.merge to handle null values
2012-12-20 22:56:54 -08:00
Michael Schoonmaker
5d2ebfbe9f Added test to confirm merging an Object and null behaves as expected. 2012-12-20 19:02:36 -08:00
Michael Hart
bb57c497d3 Prefer this fix for #65 to 6045618 2012-12-20 18:12:42 -05:00
indexzero
0d795ecf81 [test] Better tests to show #65 2012-12-20 14:08:36 -05:00
indexzero
f19f0b6c39 [test] Added failing test to illustrate #65 2012-12-20 14:01:04 -05:00
Bradley Meck
da39d3cac3 [fix] null values should merge properly instead of throwing errors 2012-09-08 20:10:58 -05:00
Bradley Meck
7421836387 [fix] heirarchy fixture file path wrong in tests 2012-09-07 09:40:15 -05:00
Bradley Meck
683f78918c [fix] #59 root get/set should work via null/undefined as key 2012-09-07 09:29:30 -05:00
indexzero
d96d2544bc [fix] Fix regression introduced by 36e061c4bd 2012-07-10 03:16:54 -04:00