1
0
Fork 0

Remove environment variables after we set them

pull/4/head
Jonathan Clem 2019-05-21 12:14:15 -04:00
parent c3ed3b105f
commit 11d5a53a98
No known key found for this signature in database
GPG Key ID: 48C5B22E9FD6E80F
1 changed files with 19 additions and 11 deletions

View File

@ -1,20 +1,28 @@
import * as os from 'os' import * as os from 'os'
import * as core from '../src/core' import * as core from '../src/core'
describe('@actions/core', () => { const testEnvVars = {
beforeEach(() => { 'my var': '',
// Clear variables 'special char var \r\n];': '',
process.env['my var'] = '' 'my var2': '',
process.env['special char var \r\n];'] = '' 'my secret': '',
process.env['my var2'] = '' 'special char secret \r\n];': '',
process.env['my secret'] = '' 'my secret2': '',
process.env['special char secret \r\n];'] = ''
process.env['my secret2'] = ''
// Set inputs // Set inputs
process.env['INPUT_MY_INPUT'] = 'val' INPUT_MY_INPUT: 'val',
process.env['INPUT_MISSING'] = '' INPUT_MISSING: '',
process.env['INPUT_SPECIAL_CHARS_\'\t"\\'] = '\'\t"\\ repsonse ' 'INPUT_SPECIAL_CHARS_\'\t"\\': '\'\t"\\ repsonse '
}
describe('@actions/core', () => {
beforeEach(() => {
for (const key in testEnvVars)
process.env[key] = testEnvVars[key as keyof typeof testEnvVars]
})
afterEach(() => {
for (const key in testEnvVars) Reflect.deleteProperty(testEnvVars, key)
}) })
it('exportVariable produces the correct command and sets the env', () => { it('exportVariable produces the correct command and sets the env', () => {