Skip to content

Commit

Permalink
chore: drop unused cmd/runTests pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 committed Jan 21, 2024
1 parent e0bb2c7 commit e132279
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 60 deletions.
2 changes: 0 additions & 2 deletions client/src/engine/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export enum Request {
apiVersion = 'api/version',
apiShutdown = 'api/shutdown',

cmdRunTests = 'cmd/runTests',

lspCheck = 'lsp/check',
lspCodelens = 'lsp/codelens',
lspHighlight = 'lsp/highlight',
Expand Down
2 changes: 0 additions & 2 deletions server/src/engine/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export enum Request {
apiVersion = 'api/version',
apiShutdown = 'api/shutdown',

cmdRunTests = 'cmd/runTests',

lspCheck = 'lsp/check',
lspCodelens = 'lsp/codelens',
lspHighlight = 'lsp/highlight',
Expand Down
53 changes: 0 additions & 53 deletions server/src/handlers/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ interface UriInput {
uri: string
}

function printHorizontalRuler() {
console.log(_.repeat(48, String.fromCodePoint(0x23e4)))
}

export function handleInitialize(_params: InitializeParams) {
const result: InitializeResult = {
capabilities: {
Expand Down Expand Up @@ -293,55 +289,6 @@ export const handleInlayHints = (params: InlayHintParams): Thenable<any> =>
socket.eventEmitter.once(job.id, makeDefaultResponseHandler(resolve))
})

/**
* @function
*/
export const handleRunTests = enqueueUnlessHasErrors(
{ request: jobs.Request.cmdRunTests },
makeRunTestsResponseHandler,
hasErrorsHandlerForCommands,
)

function prettyPrintTestResults(result: any) {
if (_.isEmpty(result)) {
// nothing to print
sendNotification(jobs.Request.internalMessage, 'No tests to run')
return
}
printHorizontalRuler()
for (const test of result) {
console.log(
test.outcome === 'success' ? String.fromCodePoint(0x2705) : String.fromCodePoint(0x274c),
test.name,
test.outcome === 'success'
? ''
: `(at ${test.location.uri}#${test.location.range.start.line}:${test.location.range.start.character})`,
)
}
printHorizontalRuler()
const totalTests = _.size(result)
const successfulTests = _.size(_.filter({ outcome: 'success' }, result))
const failingTests = totalTests - successfulTests
if (failingTests > 0) {
sendNotification(jobs.Request.internalError, {
message: `Tests Failed (${failingTests}/${totalTests})`,
actions: [],
})
} else {
sendNotification(jobs.Request.internalMessage, `Tests Passed (${successfulTests}/${totalTests})`)
}
}

function makeRunTestsResponseHandler(promiseResolver: (result?: socket.FlixResult) => void) {
return function responseHandler(flixResponse: socket.FlixResponse) {
// the status is always 'success' when with failing tests
const { result } = flixResponse
prettyPrintTestResults(result)
promiseResolver(result)
sendNotification(jobs.Request.internalFinishedJob, flixResponse)
}
}

function hasErrorsHandlerForCommands() {
sendNotification(jobs.Request.internalError, {
message: 'Cannot run commands when errors are present.',
Expand Down
3 changes: 0 additions & 3 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ connection.onNotification(jobs.Request.apiRemJar, handlers.handleRemJar)
// Show ast
connection.onNotification(jobs.Request.lspShowAst, handlers.handleShowAst)

// cmd/*
connection.onNotification(jobs.Request.cmdRunTests, handlers.handleRunTests)

// Cleanup after exit
connection.onExit(handlers.handleExit)

Expand Down

0 comments on commit e132279

Please sign in to comment.