Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier 2.0.4 #409

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"jest": "^25.1.0",
"jest-circus": "^24.7.1",
"lerna": "^3.18.4",
"prettier": "^1.19.1",
"prettier": "2.0.4",
"ts-jest": "^24.0.2",
"typescript": "^3.7.4"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/artifact/__tests__/download.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('Download Tests', () => {
]
}
const returnData: string = JSON.stringify(response, null, 2)
mockReadBody = async function(): Promise<string> {
mockReadBody = async function (): Promise<string> {
return new Promise(resolve => {
resolve(returnData)
})
Expand Down Expand Up @@ -317,7 +317,7 @@ describe('Download Tests', () => {
]
}
const returnData: string = JSON.stringify(response, null, 2)
mockReadBody = async function(): Promise<string> {
mockReadBody = async function (): Promise<string> {
return new Promise(resolve => {
resolve(returnData)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/artifact/__tests__/upload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ describe('Upload Tests', () => {
}`
}
const returnData: string = JSON.stringify(response, null, 2)
mockReadBody = async function(): Promise<string> {
mockReadBody = async function (): Promise<string> {
return new Promise(resolve => {
resolve(returnData)
})
Expand Down Expand Up @@ -463,7 +463,7 @@ describe('Upload Tests', () => {
uploadUrl: `${getRuntimeUrl()}_apis/resources/Containers/13`
}
const returnData: string = JSON.stringify(response, null, 2)
mockReadBody = async function(): Promise<string> {
mockReadBody = async function (): Promise<string> {
return new Promise(resolve => {
resolve(returnData)
})
Expand Down
6 changes: 3 additions & 3 deletions packages/exec/__tests__/exec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ describe('@actions/exec', () => {
expect(stderrCalled).toBeTruthy()
})

it('Handles child process holding streams open', async function() {
it('Handles child process holding streams open', async function () {
const semaphorePath = path.join(
getTestTemp(),
'child-process-semaphore.txt'
Expand Down Expand Up @@ -332,7 +332,7 @@ describe('@actions/exec', () => {
fs.unlinkSync(semaphorePath)
}, 10000) // this was timing out on some slower hosted macOS runs at default 5s

it('Handles child process holding streams open and non-zero exit code', async function() {
it('Handles child process holding streams open and non-zero exit code', async function () {
const semaphorePath = path.join(
getTestTemp(),
'child-process-semaphore.txt'
Expand Down Expand Up @@ -386,7 +386,7 @@ describe('@actions/exec', () => {
fs.unlinkSync(semaphorePath)
}, 10000) // this was timing out on some slower hosted macOS runs at default 5s

it('Handles child process holding streams open and stderr', async function() {
it('Handles child process holding streams open and stderr', async function () {
const semaphorePath = path.join(
getTestTemp(),
'child-process-semaphore.txt'
Expand Down
15 changes: 5 additions & 10 deletions packages/exec/src/toolrunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,7 @@ export class ToolRunner extends events.EventEmitter {
}

reverse += '"'
return reverse
.split('')
.reverse()
.join('')
return reverse.split('').reverse().join('')
}

private _uvQuoteCmdArg(arg: string): string {
Expand Down Expand Up @@ -347,10 +344,7 @@ export class ToolRunner extends events.EventEmitter {
}

reverse += '"'
return reverse
.split('')
.reverse()
.join('')
return reverse.split('').reverse().join('')
}

private _cloneExecOptions(options?: im.ExecOptions): im.ExecOptions {
Expand Down Expand Up @@ -668,8 +662,9 @@ class ExecState extends events.EventEmitter {
}

if (!state.processClosed && state.processExited) {
const message = `The STDIO streams did not close within ${state.delay /
1000} seconds of the exit event from process '${
const message = `The STDIO streams did not close within ${
state.delay / 1000
} seconds of the exit event from process '${
state.toolPath
}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`
state._debug(message)
Expand Down
70 changes: 26 additions & 44 deletions packages/tool-cache/__tests__/tool-cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,28 @@ import * as tc from '../src/tool-cache'

const IS_WINDOWS = process.platform === 'win32'

describe('@actions/tool-cache', function() {
beforeAll(function() {
nock('http://example.com')
.persist()
.get('/bytes/35')
.reply(200, {
username: 'abc',
password: 'def'
})
describe('@actions/tool-cache', function () {
beforeAll(function () {
nock('http://example.com').persist().get('/bytes/35').reply(200, {
username: 'abc',
password: 'def'
})
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 0)
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 0)
})

beforeEach(async function() {
beforeEach(async function () {
await io.rmRF(cachePath)
await io.rmRF(tempPath)
await io.mkdirP(cachePath)
await io.mkdirP(tempPath)
})

afterEach(function() {
afterEach(function () {
setResponseMessageFactory(undefined)
})

afterAll(async function() {
afterAll(async function () {
await io.rmRF(tempPath)
await io.rmRF(cachePath)
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', undefined)
Expand Down Expand Up @@ -180,13 +177,10 @@ describe('@actions/tool-cache', function() {
})

it('has status code in exception dictionary for HTTP error code responses', async () => {
nock('http://example.com')
.persist()
.get('/bytes/bad')
.reply(400, {
username: 'bad',
password: 'file'
})
nock('http://example.com').persist().get('/bytes/bad').reply(400, {
username: 'bad',
password: 'file'
})

expect.assertions(2)

Expand All @@ -199,7 +193,7 @@ describe('@actions/tool-cache', function() {
}
})

it('works with redirect code 302', async function() {
it('works with redirect code 302', async function () {
nock('http://example.com')
.persist()
.get('/redirect-to')
Expand Down Expand Up @@ -291,7 +285,7 @@ describe('@actions/tool-cache', function() {
}
})

it('extract 7z using custom 7z tool', async function() {
it('extract 7z using custom 7z tool', async function () {
const tempDir = path.join(
__dirname,
'test-extract-7z-using-custom-7z-tool'
Expand Down Expand Up @@ -480,7 +474,7 @@ describe('@actions/tool-cache', function() {
}
})

it('installs a zip and extracts it to specified directory', async function() {
it('installs a zip and extracts it to specified directory', async function () {
const tempDir = path.join(__dirname, 'test-install-zip')
try {
await io.mkdirP(tempDir)
Expand Down Expand Up @@ -537,7 +531,7 @@ describe('@actions/tool-cache', function() {
}
})

it('extract zip to a directory that does not exist', async function() {
it('extract zip to a directory that does not exist', async function () {
const tempDir = path.join(__dirname, 'test-install-zip')
try {
await io.mkdirP(tempDir)
Expand Down Expand Up @@ -591,24 +585,16 @@ describe('@actions/tool-cache', function() {
}
})

it('works with a 502 temporary failure', async function() {
nock('http://example.com')
.get('/temp502')
.twice()
.reply(502, undefined)
nock('http://example.com')
.get('/temp502')
.reply(200, undefined)
it('works with a 502 temporary failure', async function () {
nock('http://example.com').get('/temp502').twice().reply(502, undefined)
nock('http://example.com').get('/temp502').reply(200, undefined)

const statusCodeUrl = 'http://example.com/temp502'
await tc.downloadTool(statusCodeUrl)
})

it("doesn't retry 502s more than 3 times", async function() {
nock('http://example.com')
.get('/perm502')
.times(3)
.reply(502, undefined)
it("doesn't retry 502s more than 3 times", async function () {
nock('http://example.com').get('/perm502').times(3).reply(502, undefined)

expect.assertions(1)

Expand All @@ -620,7 +606,7 @@ describe('@actions/tool-cache', function() {
}
})

it('retries 429s', async function() {
it('retries 429s', async function () {
nock('http://example.com')
.get('/too-many-requests-429')
.times(2)
Expand All @@ -637,13 +623,9 @@ describe('@actions/tool-cache', function() {
}
})

it("doesn't retry 404", async function() {
nock('http://example.com')
.get('/not-found-404')
.reply(404, undefined)
nock('http://example.com')
.get('/not-found-404')
.reply(500, undefined)
it("doesn't retry 404", async function () {
nock('http://example.com').get('/not-found-404').reply(404, undefined)
nock('http://example.com').get('/not-found-404').reply(500, undefined)

try {
const statusCodeUrl = 'http://example.com/not-found-404'
Expand Down