-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Trick to get ah-next-plugin into AH monorepo without breaking jest... #491
Comments
Can you elaborate more about this commen:
Would the server boot up and try to load your tests as actions or something like that? |
In my specHelper I have an intializer that does
If next.ts initializer returns enabled: true when you run jest, all tests fail when actionhero.start() runs. So actionhero.start() does not like to run in the jest environment. I get this error:
with the default next.ts shown in this readme.
If I make sure enabled: false (when running jest) via the jest.setup.js
the tests all pass
|
In upgrading to AH 29 I followed the advice and blew up the config subdir. (a bit questionable advice???) so I lost my next.ts. When I used the one from this README it took me a while to figure out why my jest tests would all fail with actionhero.start()
This is assuming a mono repo config with "api" and "web" subdirectories with AH running in api and next running in web...
In order for the jest tests to run in the actionhero api directory, you have to disable next so actionhero.start() will work in the tests. What I had before was a jest.setup.js in the api directory that says:
The next.ts example in README.md does not skip enabling the plugin for tests.
I had to change the logic on the enable: true line to read that NEXT_ENABLED from jest.setup.js and do
Now my jest tests will run in api. Maybe some note of this could be made in the README?
The text was updated successfully, but these errors were encountered: