Skip to content

Commit

Permalink
improve test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 21, 2016
1 parent fd07b54 commit d234973
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
},
"devDependencies": {
"ava": "*",
"del": "^2.2.1",
"tempfile": "^1.1.1",
"xo": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Get the path to the config file.

### How is this different from [`configstore`](https://github.com/yeoman/configstore)?

I'm also the author of `configstore`. While it's pretty good, I did make some mistakes early on that are hard to change at this point. This module is the result of everything I learned from making `configstore`. Mainly where config is stored. In `configstore`, the config is stored in `~/.config` (which is mainly a Linux convention) on all systems, while `conf` stores config in the system default [user config directory](https://github.com/sindresorhus/env-paths#pathsconfig). The `~/.config` directory, it turns out, often have an incorrect permission on OS X and Windows, which has caused a lot of grief for users.
I'm also the author of `configstore`. While it's pretty good, I did make some mistakes early on that are hard to change at this point. This module is the result of everything I learned from making `configstore`. Mainly where config is stored. In `configstore`, the config is stored in `~/.config` (which is mainly a Linux convention) on all systems, while `conf` stores config in the system default [user config directory](https://github.com/sindresorhus/env-paths#pathsconfig). The `~/.config` directory, it turns out, often have an incorrect permission on macOS and Windows, which has caused a lot of grief for users.


## Related
Expand Down
11 changes: 5 additions & 6 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import {serial as test} from 'ava';
import tempfile from 'tempfile';
import del from 'del';
import Conf from './';

const fixture = '🦄';
Expand Down Expand Up @@ -127,11 +127,9 @@ test('`projectName` option', t => {
});

test('ensure `.store` is always an object', t => {
const tmp = tempfile();
const conf = new Conf({cwd: tmp});
try {
fs.unlinkSync(tmp);
} catch (err) {}
const cwd = tempfile();
const conf = new Conf({cwd});
del.sync(cwd, {force: true});
t.notThrows(() => conf.get('foo'));
});

Expand All @@ -148,4 +146,5 @@ test.only('automatic `projectName` inference', t => {
conf.set('foo', fixture);
t.is(conf.get('foo'), fixture);
t.true(conf.path.includes('conf'));
del.sync(conf.path, {force: true});
});

0 comments on commit d234973

Please sign in to comment.