piotrwitek / ts-mocha

Mocha thin wrapper that allows running TypeScript tests with TypeScript runtime (ts-node) to get rid of compilation complexity
MIT License
190 stars 25 forks source link

Changes (angular) src/environments/environment*.ts files #30

Closed appersonj closed 6 years ago

appersonj commented 6 years ago

I have several files in src/environments/ directory, such as environment.alternate.ts: export const environment = { production: false, envName : "alternate", version: "${project.version}", extendedVersion: "${extended-version}" }; These have template macros that are NOT intended to be expanded at compile time.

When I run: npx ts-mocha -p . 'src/**/*.test.ts'

It expands the variables (incorrectly) in the environments files, ACTUALLY MODIFYING THOSE FILES

Note : the following command does not modify the files, so I will fall back to using ts-node directly npx mocha --require ts-node/register 'src/**/*.test.ts'

piotrwitek commented 6 years ago

Hey @appersonj, Have you tried the most recent version v2.0.0 is the issue still present? We updated to the newest ts-node so it's possible it have been fixed.

appersonj commented 6 years ago

I worked around it by running tsnode directly. I'll try tsmocha again on the next project.

piotrwitek commented 6 years ago

Ok cool, so I'm closing for now as only you could confirm the issue solved. I will reopen when there is someone else hitting the same issue.