test: issue with global .asyncapi file getting overwritten while testing#27
test: issue with global .asyncapi file getting overwritten while testing#27magicmatatjahu merged 2 commits intoasyncapi:masterfrom Souvikns:fix-#23
Conversation
|
In your issue you have:
Of course not in this PR, but maybe we should have something like global config for CLI with info about path to the asyncapi context? And last, please change the prefix for PR title to |
|
@Souvikns You have one workflow which didn't pass :) |
|
Yeah, I am trying to figure that out because test cases are passing in windows and ubuntu, only failing in macOS. |
|
@magicmatatjahu can you rerun that specific action once, because it is running in my local machine. |
src/constants.ts
Outdated
There was a problem hiding this comment.
Be aware that jest only set to NODE_ENV the test if NODE_ENV isn't defined - https://jestjs.io/docs/environment-variables#node_env so maybe https://jestjs.io/docs/environment-variables#jest_worker_id will be better to check?
There was a problem hiding this comment.
Or make the fallback to check JEST_WORKER_ID.
There was a problem hiding this comment.
When I check for JEST_WORKER_ID it does not work and my .asyncapi file gets updated again.
There was a problem hiding this comment.
Even as process.env.JEST_WORKER_ID !== undefined;? So maybe we should change it to the:
| export const CONTEXT_FILENAME = (process.env['NODE_ENV'] === "test")? ".test.asyncapi": ".asyncapi"; | |
| const isTestEnv = (process.env['NODE_ENV'] === "test") || (process.env['JEST_WORKER_ID'] !== undefined) || typeof jest !== 'undefined'; | |
| export const CONTEXT_FILENAME = isTestEnv ? ".test.asyncapi" : ".asyncapi"; |
|
🎉 This PR is included in version 0.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |

Description
.asyncapifile and it was quite annoying while developing.NODE_ENVistest, and use.test.asyncapifile to do all the testing related operations.Related issue(s)
Fixes #23