File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ node_modules
22dist
33log.txt
44coverage
5- .env
5+ examples / * / .env
66pnpm-lock.yaml
77.next
Original file line number Diff line number Diff line change 1+ BASIC = basic
2+
3+ # previous line intentionally left blank
4+ AFTER_LINE = after_line
5+ EMPTY =
6+ SINGLE_QUOTES = ' single_quotes'
7+ SINGLE_QUOTES_SPACED = ' single quotes '
8+ DOUBLE_QUOTES = " double_quotes"
9+ DOUBLE_QUOTES_SPACED = " double quotes "
10+ EXPAND_NEWLINES = " expand\n new\n lines"
11+ DONT_EXPAND_UNQUOTED = dontexpand\nnewlines
12+ DONT_EXPAND_SQUOTED = ' dontexpand\nnewlines'
13+ # COMMENTS=work
14+ EQUAL_SIGNS = equals==
15+ RETAIN_INNER_QUOTES = {"foo": "bar"}
16+ RETAIN_LEADING_DQUOTE = " retained
17+ RETAIN_LEADING_SQUOTE='retained
18+ RETAIN_TRAILING_DQUOTE=retained"
19+ RETAIN_TRAILING_SQUOTE = retained'
20+ RETAIN_INNER_QUOTES_AS_STRING = ' {"foo": "bar"}'
21+ TRIM_SPACE_FROM_UNQUOTED = some spaced out string
22+ USERNAME = therealnerdybeast@example.tld
23+ SPACED_KEY = parsed
Original file line number Diff line number Diff line change 1+ import fs from 'fs'
2+ import path from 'path'
3+ import * as dotenv from '../../packages/dotenv/src'
4+
5+ const parsed = dotenv . parse ( fs . readFileSync ( path . join ( __dirname , '../fixtures/.env' ) , { encoding : 'utf8' } ) )
6+
7+ describe ( 'Dotenv parsing' , ( ) => {
8+ it ( 'sets basic environment variable' , ( ) => {
9+ expect ( parsed . BASIC ) . toBe ( 'basic' )
10+ } )
11+ it ( 'reads after a skipped line' , ( ) => {
12+ expect ( parsed . AFTER_LINE ) . toBe ( 'after_line' )
13+ } )
14+ it ( 'defaults empty values to empty string' , ( ) => {
15+ expect ( parsed . EMPTY ) . toBe ( '' )
16+ } )
17+ it ( 'escapes single quoted values' , ( ) => {
18+ expect ( parsed . SINGLE_QUOTES ) . toBe ( 'single_quotes' )
19+ } )
20+ } )
You can’t perform that action at this time.
0 commit comments