Fix test failures introduced by making code more robust
This commit is contained in:
parent
24096a1cb3
commit
14d602cced
3 changed files with 8 additions and 8 deletions
6
lib/config-utils.test.js
generated
6
lib/config-utils.test.js
generated
|
|
@ -95,18 +95,18 @@ ava_1.default("load non-empty input", async (t) => {
|
||||||
- b
|
- b
|
||||||
paths:
|
paths:
|
||||||
- c/d`;
|
- c/d`;
|
||||||
|
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
||||||
// And the config we expect it to parse to
|
// And the config we expect it to parse to
|
||||||
const expectedConfig = new configUtils.Config();
|
const expectedConfig = new configUtils.Config();
|
||||||
expectedConfig.name = 'my config';
|
expectedConfig.name = 'my config';
|
||||||
expectedConfig.disableDefaultQueries = true;
|
expectedConfig.disableDefaultQueries = true;
|
||||||
expectedConfig.additionalQueries.push(tmpDir);
|
expectedConfig.additionalQueries.push(fs.realpathSync(tmpDir));
|
||||||
expectedConfig.additionalQueries.push(path.join(tmpDir, 'foo'));
|
expectedConfig.additionalQueries.push(fs.realpathSync(path.join(tmpDir, 'foo')));
|
||||||
expectedConfig.externalQueries = [new configUtils.ExternalQuery('foo/bar', 'dev')];
|
expectedConfig.externalQueries = [new configUtils.ExternalQuery('foo/bar', 'dev')];
|
||||||
expectedConfig.pathsIgnore = ['a', 'b'];
|
expectedConfig.pathsIgnore = ['a', 'b'];
|
||||||
expectedConfig.paths = ['c/d'];
|
expectedConfig.paths = ['c/d'];
|
||||||
fs.writeFileSync(path.join(tmpDir, 'input'), inputFileContents, 'utf8');
|
fs.writeFileSync(path.join(tmpDir, 'input'), inputFileContents, 'utf8');
|
||||||
setInput('config-file', 'input');
|
setInput('config-file', 'input');
|
||||||
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
|
||||||
const actualConfig = await configUtils.loadConfig();
|
const actualConfig = await configUtils.loadConfig();
|
||||||
// Should exactly equal the object we constructed earlier
|
// Should exactly equal the object we constructed earlier
|
||||||
t.deepEqual(actualConfig, expectedConfig);
|
t.deepEqual(actualConfig, expectedConfig);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -100,12 +100,14 @@ test("load non-empty input", async t => {
|
||||||
paths:
|
paths:
|
||||||
- c/d`;
|
- c/d`;
|
||||||
|
|
||||||
|
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
||||||
|
|
||||||
// And the config we expect it to parse to
|
// And the config we expect it to parse to
|
||||||
const expectedConfig = new configUtils.Config();
|
const expectedConfig = new configUtils.Config();
|
||||||
expectedConfig.name = 'my config';
|
expectedConfig.name = 'my config';
|
||||||
expectedConfig.disableDefaultQueries = true;
|
expectedConfig.disableDefaultQueries = true;
|
||||||
expectedConfig.additionalQueries.push(tmpDir);
|
expectedConfig.additionalQueries.push(fs.realpathSync(tmpDir));
|
||||||
expectedConfig.additionalQueries.push(path.join(tmpDir, 'foo'));
|
expectedConfig.additionalQueries.push(fs.realpathSync(path.join(tmpDir, 'foo')));
|
||||||
expectedConfig.externalQueries = [new configUtils.ExternalQuery('foo/bar', 'dev')];
|
expectedConfig.externalQueries = [new configUtils.ExternalQuery('foo/bar', 'dev')];
|
||||||
expectedConfig.pathsIgnore = ['a', 'b'];
|
expectedConfig.pathsIgnore = ['a', 'b'];
|
||||||
expectedConfig.paths = ['c/d'];
|
expectedConfig.paths = ['c/d'];
|
||||||
|
|
@ -113,8 +115,6 @@ test("load non-empty input", async t => {
|
||||||
fs.writeFileSync(path.join(tmpDir, 'input'), inputFileContents, 'utf8');
|
fs.writeFileSync(path.join(tmpDir, 'input'), inputFileContents, 'utf8');
|
||||||
setInput('config-file', 'input');
|
setInput('config-file', 'input');
|
||||||
|
|
||||||
fs.mkdirSync(path.join(tmpDir, 'foo'));
|
|
||||||
|
|
||||||
const actualConfig = await configUtils.loadConfig();
|
const actualConfig = await configUtils.loadConfig();
|
||||||
|
|
||||||
// Should exactly equal the object we constructed earlier
|
// Should exactly equal the object we constructed earlier
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue