Skip to content

Commit 130d797

Browse files
committed
Revert "fix: something"
This reverts commit ca534ee.
1 parent ca534ee commit 130d797

File tree

18 files changed

+48
-68
lines changed

18 files changed

+48
-68
lines changed

bin/codecept.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const errorHandler = (fn) => async (...args) => {
3131
};
3232

3333
if (process.versions.node && process.versions.node.split('.') && process.versions.node.split('.')[0] < 12) {
34-
outputLib.output.error('NodeJS >= 12 is required to run.');
34+
outputLib.output.output.error('NodeJS >= 12 is required to run.');
3535
outputLib.print();
3636
outputLib.print('Please upgrade your NodeJS engine');
3737
outputLib.print(`Current NodeJS version: ${process.version}`);

lib/ai.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { Configuration, OpenAIApi } from 'openai';
2-
import createDebugMessages from 'debug';
2+
import debug from 'debug';
33
import config from './config.js';
44
import * as output from './output.js';
55
import { removeNonInteractiveElements, minifyHtml, splitByChunks } from './html.js';
66

7-
const debug = createDebugMessages('codeceptjs');
8-
97
debug('codeceptjs:ai');
108

119
const defaultConfig = {

lib/codecept.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ import listener01234 from './listener/timeout.js';
4343

4444
import listener012345 from './listener/exit.js';
4545

46-
import 'chai/register-assert.js';
47-
import 'chai/register-expect.js';
48-
4946
const __dirname = dirname(fileURLToPath(import.meta.url));
5047
const require = createRequire(import.meta.url);
5148

@@ -121,7 +118,7 @@ export default class Codecept {
121118
global.inject = container.support;
122119
global.share = container.share;
123120
global.secret = secret;
124-
global.codecept_debug = output.output.debug;
121+
global.codecept_debug = output.debug;
125122
global.codeceptjs = index; // load all objects
126123
global.Given = stepDefinitions.Given;
127124
global.When = stepDefinitions.When;

lib/container.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,7 @@ function createHelpers(config) {
175175
// check if the helper is the built-in, use the require() syntax.
176176
if (moduleName.startsWith('./helper/')) {
177177
const __dirname = dirname(fileURLToPath(import.meta.url));
178-
try {
179-
HelperClass = importSync(path.resolve(__dirname, moduleName)).default;
180-
} catch (e) {
181-
HelperClass = importSync(path.resolve(__dirname, moduleName));
182-
}
178+
HelperClass = importSync(path.resolve(__dirname, moduleName)).default;
183179
} else {
184180
// check if the new syntax export default HelperName is used and loads the Helper, otherwise loads the module that used old syntax export = HelperName.
185181
HelperClass = importSync(path.resolve(moduleName)).default;

lib/event.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import createDebugMessages from 'debug';
1+
import debug from 'debug';
22

33
import events from 'events';
44
import * as output from './output.js';
55

6-
const debug = createDebugMessages('codeceptjs');
7-
86
debug('codeceptjs:event');
97

108
const dispatcher = new events.EventEmitter();

lib/helper/Expect.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
import { expect } from 'chai';
2+
import * as chai from 'chai';
13
import chai_json_schema from 'chai-json-schema';
24
import chai_match_pattern from 'chai-match-pattern';
35
import chai_exclude from 'chai-exclude';
46
import chai_string from 'chai-string';
5-
import { expect, use } from 'chai';
67
import * as output from '../output.js';
78

8-
use(chai_string);
9+
chai.use(chai_string);
910
// @ts-ignore
10-
use(chai_exclude);
11-
use(chai_match_pattern);
12-
use(chai_json_schema);
11+
chai.use(chai_exclude);
12+
chai.use(chai_match_pattern);
13+
chai.use(chai_json_schema);
1314

1415
/**
1516
* This helper allows performing assertions based on Chai.

lib/interfaces/gherkin.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as Gherkin from '@cucumber/gherkin';
22
import * as Messages from '@cucumber/messages';
33
import { Context, Suite, Test } from 'mocha';
44

5-
import createDebugMessages from 'debug';
5+
import debug from 'debug';
66

77
import { matchStep } from './bdd.js';
88
import * as event from '../event.js';
@@ -13,8 +13,6 @@ import transform from '../transform.js';
1313

1414
import translations0 from '../translation.js';
1515

16-
const debug = createDebugMessages('codeceptjs');
17-
1816
debug('codeceptjs:bdd');
1917

2018
const uuidFn = Messages.IdGenerator.uuid();

lib/listener/steps.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import createDebugMessages from 'debug';
1+
import debug from 'debug';
22
import * as event from '../event.js';
33
import { store } from '../store.js';
44
import * as output from '../output.js';
55

6-
const debug = createDebugMessages('codeceptjs');
7-
86
debug('codeceptjs:steps');
97

108
let currentTest;

lib/pause.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import colors from 'chalk';
22
import readline from 'readline';
33
import ora from 'ora-classic';
4-
import createDebugMessages from 'debug';
4+
import debug from 'debug';
55

66
import container from './container.js';
77
import history from './history.js';
@@ -12,8 +12,6 @@ import * as event from './event.js';
1212
import * as output from './output.js';
1313
import { methodsOfObject } from './utils.js';
1414

15-
const debug = createDebugMessages('codeceptjs');
16-
1715
debug('codeceptjs:pause');
1816

1917
// npm install colors

lib/plugin/autoLogin.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { fileExists, isAsyncFunction } from '../utils.js';
44
import container from '../container.js';
55
import { store } from '../store.js';
66
import recorder from '../recorder.js';
7-
import * as output from '../output.js';
7+
import { debug } from '../output.js';
88

99
const defaultUser = {
1010
fetch: I => I.grabCookie(),
@@ -267,7 +267,7 @@ export default function (config) {
267267
} catch (err) {
268268
throw new Error(`Could not load session from ${fileName}\n${err}`);
269269
}
270-
output.output.debug(`Loaded user session for ${name}`);
270+
debug(`Loaded user session for ${name}`);
271271
}
272272
}
273273

@@ -288,11 +288,11 @@ export default function (config) {
288288

289289
const cookies = await userSession.fetch(I);
290290
if (!cookies) {
291-
output.output.debug('Cannot save user session with empty cookies from auto login\'s fetch method');
291+
debug('Cannot save user session with empty cookies from auto login\'s fetch method');
292292
return;
293293
}
294294
if (config.saveToFile) {
295-
output.output.debug(`Saved user session into file for ${name}`);
295+
debug(`Saved user session into file for ${name}`);
296296
fs.writeFileSync(path.join(global.output_dir, `${name}_session.json`), JSON.stringify(cookies));
297297
}
298298
store[`${name}_session`] = cookies;
@@ -309,12 +309,12 @@ export default function (config) {
309309
userSession.check(I, cookies);
310310
}
311311
recorder.session.catch((err) => {
312-
output.output.debug(`Failed auto login for ${name} due to ${err}`);
313-
output.output.debug('Logging in again');
312+
debug(`Failed auto login for ${name} due to ${err}`);
313+
debug('Logging in again');
314314
recorder.session.start('auto login');
315315
return loginAndSave().then(() => {
316316
recorder.add(() => recorder.session.restore('auto login'));
317-
recorder.catch(() => output.output.debug('continue'));
317+
recorder.catch(() => debug('continue'));
318318
}).catch((err) => {
319319
recorder.session.restore('auto login');
320320
recorder.session.restore('check login');

0 commit comments

Comments
 (0)