Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Feb 19, 2024
1 parent ce02ec3 commit e8311bb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,27 @@ import { openTestTag } from './tags'
import { workerPath } from './constants'

export async function activate(context: vscode.ExtensionContext) {
// TODO: just to test, improve the logic!
const workspacePath = vscode.workspace.workspaceFolders?.[0].uri.fsPath
log.info('workspace path', workspacePath, workerPath)
if (workspacePath) {
const vitestPath = require.resolve('vitest', { paths: [workspacePath] }) // resolves to cjs
const workspacePaths = vscode.workspace.workspaceFolders?.map(x => x.uri.fsPath)
if (workspacePaths?.length) {
const vitestPath = require.resolve('vitest', { paths: workspacePaths }) // resolves to cjs
log.info('vitest path', vitestPath, resolve(dirname(vitestPath), './dist/node.js'))
const worker = new Worker(workerPath, {
workerData: {
root: workspacePath,
root: workspacePaths[0],
vitestPath: resolve(dirname(vitestPath), './dist/node.js'),
},
})
worker.stdout.on('data', (d) => {
log.info('worker error', d.toString())
log.info('worker log', d.toString())
})
worker.stderr.on('data', (d) => {
log.error('worker error', d.toString())
})
worker.on('message', (d) => {
log.info(JSON.stringify(d))
// worker.terminate()
})
}

await detectVitestEnvironmentFolders()
if (vitestEnvironmentFolders.length === 0) {
log.info('The extension is not activated because no Vitest environment was detected.')
Expand Down

0 comments on commit e8311bb

Please sign in to comment.