-
-
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
"codeceptjs gt" fails if config contains a custom helper: Could not load helper MyHelper from module './helper/Playwright' #3512
Comments
For the reported case (helper in JavaScript), it seems to be fixed by a8c2cb2 However it fails for helper in TypeScript, this time with another error: Could not load helper MyHelper from module '/home/mirao/tmp/myhelper_helper.ts':
Helper is not defined
ReferenceError: Helper is not defined
at Object.<anonymous> (/home/mirao/tmp/myhelper_helper.ts:1:1)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Module.m._compile (/home/mirao/tmp/node_modules/ts-node/src/index.ts:1618:23)
at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Object.require.extensions.<computed> [as .ts] (/home/mirao/tmp/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at createHelpers (/home/mirao/tmp/node_modules/codeceptjs/lib/container.js:170:33)
Error:
at createHelpers (/home/mirao/tmp/node_modules/codeceptjs/lib/container.js:186:19)
at Function.create (/home/mirao/tmp/node_modules/codeceptjs/lib/container.js:46:29)
at /home/mirao/tmp/node_modules/codeceptjs/lib/command/generate.js:60:15
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Command.<anonymous> (/home/mirao/tmp/node_modules/codeceptjs/bin/codecept.js:9:5) myhelper_helper.ts class MyHelper extends Helper {
// before/after hooks
/**
* @protected
*/
_before() {
// remove if not used
}
/**
* @protected
*/
_after() {
// remove if not used
}
// add custom methods here
// If you need to access other helpers
// use: this.helpers['helperName']
}
export = MyHelper; codecept.conf.ts import { setHeadlessWhen, setCommonPlugins } from '@codeceptjs/configure';
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);
// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();
export const config: CodeceptJS.MainConfig = {
tests: './*_test.ts',
output: './output',
helpers: {
Playwright: {
url: 'http://localhost',
show: true,
browser: 'chromium'
},
MyHelper: {
require: './myhelper_helper.ts',
},
},
include: {
I: './steps_file'
},
name: 'tmp',
fullPromiseBased: true
} It works well with CodeceptJS 3.3.6, with TS helper. |
It fails only if It seems that 3.3.7 is missing a global definition of "Helper" so that you don't need to specify it in every custom helper ? |
A possible fix is mentioned in #3514 (comment). |
It's a regression in 3.3.7.
It works well in 3.3.6
What are you trying to achieve?
npx codeceptjs gt
should workWhat do you get instead?
When you set a feature name and a file name, it fails
myhelper_helper.js
Details
codecept.conf.ts
The text was updated successfully, but these errors were encountered: