attempt at fixing some windows test failures
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { ConfigSources } from './ConfigSources';
|
||||
import { ConfigSource } from './types';
|
||||
import { MutableConfigSource } from './MutableConfigSource';
|
||||
@@ -41,6 +42,8 @@ function mergeSources(source: ConfigSource): ConfigSource[] {
|
||||
] as ConfigSource[];
|
||||
}
|
||||
|
||||
const root = resolvePath('/');
|
||||
|
||||
describe('ConfigSources', () => {
|
||||
it('should parse args', () => {
|
||||
expect(ConfigSources.parseArgs([])).toEqual([]);
|
||||
@@ -70,7 +73,7 @@ describe('ConfigSources', () => {
|
||||
mergeSources(
|
||||
ConfigSources.defaultForTargets({ rootDir: '/', targets: [] }),
|
||||
),
|
||||
).toEqual([{ name: 'FileConfigSource', path: '/app-config.yaml' }]);
|
||||
).toEqual([{ name: 'FileConfigSource', path: `${root}app-config.yaml` }]);
|
||||
|
||||
const fsSpy = jest.spyOn(fs, 'pathExistsSync').mockReturnValue(true);
|
||||
expect(
|
||||
@@ -78,8 +81,8 @@ describe('ConfigSources', () => {
|
||||
ConfigSources.defaultForTargets({ rootDir: '/', targets: [] }),
|
||||
),
|
||||
).toEqual([
|
||||
{ name: 'FileConfigSource', path: '/app-config.yaml' },
|
||||
{ name: 'FileConfigSource', path: '/app-config.local.yaml' },
|
||||
{ name: 'FileConfigSource', path: `${root}app-config.yaml` },
|
||||
{ name: 'FileConfigSource', path: `${root}app-config.local.yaml` },
|
||||
]);
|
||||
fsSpy.mockRestore();
|
||||
|
||||
@@ -90,7 +93,7 @@ describe('ConfigSources', () => {
|
||||
targets: [{ type: 'path', target: '/config.yaml' }],
|
||||
}),
|
||||
),
|
||||
).toEqual([{ name: 'FileConfigSource', path: '/config.yaml' }]);
|
||||
).toEqual([{ name: 'FileConfigSource', path: `${root}config.yaml` }]);
|
||||
|
||||
const subFunc = async () => undefined;
|
||||
expect(
|
||||
@@ -104,7 +107,7 @@ describe('ConfigSources', () => {
|
||||
).toEqual([
|
||||
{
|
||||
name: 'FileConfigSource',
|
||||
path: '/config.yaml',
|
||||
path: `${root}config.yaml`,
|
||||
substitutionFunc: subFunc,
|
||||
},
|
||||
]);
|
||||
@@ -156,7 +159,7 @@ describe('ConfigSources', () => {
|
||||
}),
|
||||
),
|
||||
).toEqual([
|
||||
{ name: 'FileConfigSource', path: '/app-config.yaml' },
|
||||
{ name: 'FileConfigSource', path: `${root}app-config.yaml` },
|
||||
{ name: 'EnvConfigSource', env: { HOME: '/' } },
|
||||
]);
|
||||
|
||||
@@ -190,9 +193,9 @@ describe('ConfigSources', () => {
|
||||
]),
|
||||
),
|
||||
).toEqual([
|
||||
{ name: 'FileConfigSource', path: '/a.yaml' },
|
||||
{ name: 'FileConfigSource', path: '/b.yaml' },
|
||||
{ name: 'FileConfigSource', path: '/c.yaml' },
|
||||
{ name: 'FileConfigSource', path: `${root}a.yaml` },
|
||||
{ name: 'FileConfigSource', path: `${root}b.yaml` },
|
||||
{ name: 'FileConfigSource', path: `${root}c.yaml` },
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user