@@ -860,4 +860,28 @@ process.on('message', (message) => {
|
860 | 860 | `Completed running ${inspect(file)}. Waiting for file changes before restarting...`, |
861 | 861 | ]); |
862 | 862 | }); |
| 863 | + |
| 864 | +it('should support multiple --env-file flags', async () => { |
| 865 | +const envKey = `TEST_ENV_A_${Date.now()}`; |
| 866 | +const envKey2 = `TEST_ENV_B_${Date.now()}`; |
| 867 | +const jsFile = createTmpFile(`console.log('ENV_A: ' + process.env.${envKey} + '\\n' + 'ENV_B: ' + process.env.${envKey2});`); |
| 868 | +const envFileA = createTmpFile(`${envKey}=123`, '.env'); |
| 869 | +const envFileB = createTmpFile(`${envKey2}=456`, '.env'); |
| 870 | +const { done, restart } = runInBackground({ |
| 871 | +args: ['--watch', `--env-file=${envFileA}`, `--env-file=${envFileB}`, jsFile] |
| 872 | +}); |
| 873 | + |
| 874 | +try { |
| 875 | +const { stderr, stdout } = await restart(); |
| 876 | + |
| 877 | +assert.strictEqual(stderr, ''); |
| 878 | +assert.deepStrictEqual(stdout, [ |
| 879 | +'ENV_A: 123', |
| 880 | +'ENV_B: 456', |
| 881 | +`Completed running ${inspect(jsFile)}. Waiting for file changes before restarting...`, |
| 882 | +]); |
| 883 | +} finally { |
| 884 | +await done(); |
| 885 | +} |
| 886 | +}); |
863 | 887 | }); |