-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
bugcurrent functionality does not work as desiredcurrent functionality does not work as desiredhelp wantedscope:globbingscope:internalsscope:typescript
Description
Line number selection doesn't use the @ava/typescript
provider to resolve the compiled JS file. This means it's parsing the actual TypeScript file which is not supported:
Lines 42 to 51 in ac0d75d
let checkSelectedByLineNumbers; | |
try { | |
checkSelectedByLineNumbers = lineNumberSelection({ | |
file: options.file, | |
lineNumbers: options.lineNumbers, | |
}); | |
} catch (error) { | |
channel.send({type: 'line-number-selection-error', err: serializeError('Line number selection error', false, error, options.file)}); | |
checkSelectedByLineNumbers = () => false; | |
} |
We'd need to amend the worker interface to make the file resolver available:
This requires a new protocol identifier, and the file resolver should only be called if available to retain compatibility with the current @ava/typescript
version. I can explain more when we get to this point:
Lines 12 to 14 in ac0d75d
const levelsByProtocol = { | |
'ava-3.2': levels.levelIntegersAreCurrentlyUnused, | |
}; |
We can then install the providers earlier:
Lines 123 to 132 in ac0d75d
// Install before processing options.require, so if helpers are added to the | |
// require configuration the *compiled* helper will be loaded. | |
const {projectDir, providerStates = []} = options; | |
const providers = []; | |
await Promise.all(providerStates.map(async ({type, state}) => { | |
if (type === 'typescript') { | |
const provider = await providerManager.typescript(projectDir); | |
providers.push(provider.worker({extensionsToLoadAsModules, state})); | |
} | |
})); |
Metadata
Metadata
Assignees
Labels
bugcurrent functionality does not work as desiredcurrent functionality does not work as desiredhelp wantedscope:globbingscope:internalsscope:typescript