Skip to content

Commit 4bd61aa

Browse files
committed
fix more runner tests
1 parent e0761be commit 4bd61aa

File tree

9 files changed

+16
-12
lines changed

9 files changed

+16
-12
lines changed

lib/globals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export async function initCodeceptGlobals(dir, config, container) {
4646
return locator.build(locatorQuery)
4747
}
4848

49-
global.inject = container.support
49+
global.inject = () => container.support()
5050
global.share = container.share
5151

5252
const secretModule = await import('./secret.js')

lib/mocha/inject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const getInjectedArguments = async (fn, test) => {
2929
if (!objects[key]) {
3030
throw new Error(`Object of type ${key} is not defined in container`)
3131
}
32-
testArgs[key] = container.support(key)
32+
testArgs[key] = objects[key]
3333
}
3434

3535
if (test) {

test/data/sandbox/bootstrap.async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = function (done) {
1+
export default function (done) {
22
let i = 0;
33
setTimeout(() => {
44
i++;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = async (done) => {
1+
export default async (done) => {
22
await console.log('"bootstrapAll" is called.');
33
done();
44
};

test/data/sandbox/bootstrapall.object.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
bootstrapAll: async (done) => {
33
await console.log('"bootstrapAll" is called.');
44
done();

test/data/sandbox/configs/allure/pages/custom_steps.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
module.exports = () => {
1+
import { actor } from '../../../../../lib/index.js';
2+
3+
export default () => {
24
return actor({
35
openDir() {
46
this.amInPath('.');
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
let I;
2-
3-
module.exports = {
1+
const MyPage = {
42

53
_init() {
6-
I = actor();
4+
// Legacy method - not needed with inject pattern
75
},
86

97
hasFile(arg) {
8+
const { I } = inject();
109
I.seeFile('allure.conf.js');
1110
I.seeFile('codecept.po.js');
1211
},
1312

1413
failedMethod() {
14+
const { I } = inject();
1515
I.seeFile('notexistfile.js');
1616
},
1717
};
18+
19+
export default MyPage;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = async (done) => {
1+
export default async (done) => {
22
await console.log('"teardownAll" is called.');
33
done();
44
};

test/data/sandbox/teardownall.object.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
teardownAll: async (done) => {
33
await console.log('"teardownAll" is called.');
44
done();

0 commit comments

Comments
 (0)