diff --git a/tests/parser.spec.ts b/tests/parser.spec.ts index 6f5cc88..953e15a 100644 --- a/tests/parser.spec.ts +++ b/tests/parser.spec.ts @@ -95,6 +95,25 @@ test.group('Env Parser', () => { }) }) + test('allows to escape the identifier', async ({ assert, cleanup, expectTypeOf }) => { + cleanup(() => { + EnvParser.removeIdentifier('file') + }) + + EnvParser.identifier('file', (_value: string) => { + return '3000' + }) + + const envString = ['ENV_USER=file\\:///root/app/user.js'].join('\n') + const parser = new EnvParser(envString) + const parsed = await parser.parse() + + expectTypeOf(parsed).toEqualTypeOf() + assert.deepEqual(parsed, { + ENV_USER: 'file:///root/app/user.js', + }) + }) + test('throw when identifier is already defined', async ({ assert, cleanup }) => { cleanup(() => { EnvParser.removeIdentifier('file')