-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue migrating my generators' tests to TypeScript (ERR_PACKAGE_PATH_NOT_EXPORTED) #164
Comments
same error for me, i try to use yeoman-test for my generator with mocha and exactly the same error : ( Always no solution ? |
yeoman-test@7 is in typescript and have built-in types, maybe drop the |
Thanks for your answer but removing |
I also tried to upgrade to |
yeoman-test@7 is native esm: https://github.com/yeoman/yeoman-test/releases/tag/v7.0.0 You need to convert your project to esm, commonjs won't work: Or stick with yeoman-test@6 |
@mshima thanks a lot for your help. My tests are now passing. I lost my code coverage but I'll dig into it. I'm not sure the problem comes from In case anybody encounters this issue, here is a diff between before and after the TypeScript migration: groovytron/generator-skjol@1.1.1...2.0.0-rc.0 |
I managed to fix my code coverage issue by migrating to Here are my changes: groovytron/generator-skjol@be4970f Here are my findings: |
For future reference, the project don't need to be esm, tests need to be esm. Can use |
We should consider backward-compatibility and not have to force users to move to ECMA. Companies using this have to seriously consider the consequences of not unit testing their generators and having to rely on older versions while maintaining their generators. Sure, reverting to 6 is OK, but when one runs |
Dependencies would be outdated since they are migrating to esm too. describe(() => {
let helpers;
before(async() => {
helpers = (await import('yeoman-test')).default;
});
}); |
Hi,
I'm having troubles migrating my generators' tests to TypeScript.
My project is https://github.com/groovytron/generator-skjol. The migration branch is
migrate-to-typescript
.I get the following error when I run
npm run test
(which runs the tests with Mocha like the previous version of my project):My current node version is
v19.4.0
.Is there an issue with
yeoman-test
's exports or am I doing something wrong with my Mocha TypeScript configuration ?I tried to use Jest instead because I was suspecting there was an issue with
ts-node
when used with Mocha but I stumble on the same error. Jest is installed to. You can test with Jest by renaming theslides.spec.jest.ts
intoslides.spec.ts
and runnpm run jest
.I'm actually just testing the slides generator so only the script
slides.spec.ts
is executed at the moment. I will migrate the other tests once this one works.Thanks a lot for your help and have a nice day.
The text was updated successfully, but these errors were encountered: