Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

191
Visualizações
How to test source code produced by a compiler/transpiler

I am working on a compiler that generates JavaScript modules and their associated type declarations: it takes one source with a specific grammar and output 3 different files:

  1. a ESM implementation
  2. a CJS implementation
  3. A type declaration

Those files export a class with a bunch of methods (that's an example of the type definition that's being generated):

export default class MyClass extends Base {
  myApi1(): Promise<void>;
  getFoo(): Promise<string>;
  // ...
}

All those files are generated by the compiler itself and I am wondering what would good testing strategies to satisfy the following criteria:

  • JS modules are valid JS files
  • The type declaration is a valid TS file
  • All files don't have extra/missing imports
  • That the generated types are corrects (methods have correct arg and return types)
  • Tests can be run in CI and be as fast as possible
  • Tests are as reliable as possible

More broadly my question is how to test generated files from a compiler/transpiler when those aren't bytecode?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda