From 2beb5bf170b341e4d089b639f0c3faf07fec0a9a Mon Sep 17 00:00:00 2001 From: Blaine Bublitz <blaine.bublitz@gmail.com> Date: Tue, 12 Mar 2024 21:07:06 -0700 Subject: [PATCH] add test --- .../configfiles/override-config-path.json | 3 +++ test/index.js | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/fixtures/configfiles/override-config-path.json diff --git a/test/fixtures/configfiles/override-config-path.json b/test/fixtures/configfiles/override-config-path.json new file mode 100644 index 0000000..f1968d7 --- /dev/null +++ b/test/fixtures/configfiles/override-config-path.json @@ -0,0 +1,3 @@ +{ + "myappfile": "./override-the-config-path.js" +} diff --git a/test/index.js b/test/index.js index aa6264e..f9a8b5a 100644 --- a/test/index.js +++ b/test/index.js @@ -571,6 +571,21 @@ describe('Liftoff', function () { ); }); + it('overrides the configPath if the configName key exists in the config', function (done) { + var app = new Liftoff({ + name: 'myapp', + configFiles: { + 'override-config-path': [ + { path: 'test/fixtures/configfiles', extensions: ['.js', '.json'] } + ], + }, + }); + app.prepare({}, function (env) { + expect(env.configPath).toEqual('./override-the-config-path.js'); + done(); + }); + }); + it('should use dirname of configPath if no cwd is specified', function (done) { var app = new Liftoff({ name: 'myapp',