-
-
Notifications
You must be signed in to change notification settings - Fork 723
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
fix: undefined global codeceptjs dir #3514
Conversation
Custom Helper:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't like this fix
also I didn't understand when the bug happens
@@ -8,6 +8,9 @@ const recorder = require('./recorder'); | |||
const event = require('./event'); | |||
const WorkerStorage = require('./workerStorage'); | |||
const store = require('./store'); | |||
const { getTestRoot } = require('../lib/command/utils'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm against including this into a container
container should not know anything about filesystem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just solved it to myself by putting of global.codecept_dir = testsPath;
after
CodeceptJS/lib/command/generate.js
Line 26 in ad5f4af
const testsPath = getTestRoot(genPath); |
But still there is an issue that all custom helpers need to have included const Helper = require('@codeceptjs/helper');
, otherwise you get the issue #3512 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But still there is an issue that all custom helpers need to have included const Helper = require('@codeceptjs/helper');, otherwise you get the issue #3512 (comment)
On the other hand
- Newly created Helpers (by
codeceptjs gh
) have the variableHelper
set - I can fix my existing custom helpers easily
- As for other custom helpers that I use, only
codeceptjs-chai
doesn't haveHelper
set and I must patch it. Others (codeceptjs-cmdhelper
,codeceptjs-dbhelper
andcodeceptjs-pixelmatchhelper
) are already set correctly.
So it's not a big issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff --git a/index.js b/index.js
index bd248fce8c1581fe07a63abae3a469159e7891ca..7cd6dcca0e8ba1e47195e8053f07187ca08782ca 100644
--- a/index.js
+++ b/index.js
@@ -1,3 +1,5 @@
+const Helper = require('@codeceptjs/helper');
+
/* eslint-disable global-require */
const chai = require( 'chai' );
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this patch would help in general
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kobenguyent Thanks. Your PR really helps to solve the issue and therefore my patch is not needed anymore.
I tested that then codeceptjs run
and codeceptjs gt
work well in a project using codeceptjs-chai
.
Hey @DavertMik i guess the issue is from here #3512 but not enough knowledge where to put fix. So leave it to you then. |
Motivation/Description of the PR
Applicable helpers:
Applicable plugins:
Type of change
Checklist:
npm run docs
)npm run lint
)npm test
)