diff --git a/packages/taro-cli/src/__tests__/dotenv-parse.spec.ts b/packages/taro-cli/src/__tests__/dotenv-parse.spec.ts index 3a20f9dd3269..927a22562675 100644 --- a/packages/taro-cli/src/__tests__/dotenv-parse.spec.ts +++ b/packages/taro-cli/src/__tests__/dotenv-parse.spec.ts @@ -29,6 +29,7 @@ describe('inspect', () => { delete process.env.TARO_APP_ID delete process.env.JD_APP_TEST delete process.env.TARO_APP_DEFAULT + delete process.env.TARO_APP_FOO }) afterEach(() => { @@ -40,6 +41,7 @@ describe('inspect', () => { delete process.env.TARO_APP_ID delete process.env.JD_APP_TEST delete process.env.TARO_APP_DEFAULT + delete process.env.TARO_APP_FOO }) describe('cli mode env', () => { @@ -93,5 +95,11 @@ describe('inspect', () => { expect(process.env.TARO_APP_TEST).toEqual(undefined) expect(process.env.TARO_APP_ID).toEqual('特殊变量appid') }) + + it('环境变量可以相互引用', async () => { + setProcessArgv('taro build --type weapp --mode pre') + await cli.run() + expect(process.env.TARO_APP_FOO).toEqual('env-pre-foo') + }) }) }) diff --git a/packages/taro-cli/src/__tests__/fixtures/default/.env.pre b/packages/taro-cli/src/__tests__/fixtures/default/.env.pre index c6a3e880fded..ec139f2c5960 100644 --- a/packages/taro-cli/src/__tests__/fixtures/default/.env.pre +++ b/packages/taro-cli/src/__tests__/fixtures/default/.env.pre @@ -1 +1,3 @@ -TARO_APP_TEST=env-pre \ No newline at end of file +TARO_APP_TEST=env-pre + +TARO_APP_FOO=${TARO_APP_TEST}-foo \ No newline at end of file