codeceptjs 3.3.5-beta.1 → 3.3.5-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,10 +54,6 @@ module.exports = function() {
54
54
  }
55
55
  `;
56
56
 
57
- const tsNodeRequired = `require('ts-node/register');
58
-
59
- `;
60
-
61
57
  module.exports = function (initPath) {
62
58
  const testsPath = getTestRoot(initPath);
63
59
 
@@ -186,7 +182,7 @@ module.exports = function (initPath) {
186
182
  }
187
183
 
188
184
  if (isTypeScript) {
189
- configSource = `${tsNodeRequired}\n${configSource}`;
185
+ configSource = beautify(`export const config : CodeceptJS.MainConfig = ${inspect(config, false, 4, false)}`);
190
186
  fs.writeFileSync(typeScriptconfigFile, configSource, 'utf-8');
191
187
  print(`Config created at ${typeScriptconfigFile}`);
192
188
  } else {
@@ -250,15 +246,6 @@ module.exports = function (initPath) {
250
246
  if (packages) {
251
247
  try {
252
248
  install(packages);
253
-
254
- if (testsPath) {
255
- print(generateDefinitionsManually);
256
- } else {
257
- const { code } = spawn.sync('npx', ['codeceptjs', 'def']);
258
- if (code !== 0) {
259
- print(generateDefinitionsManually);
260
- }
261
- }
262
249
  } catch (err) {
263
250
  print(colors.bold.red(err.toString()));
264
251
  print();
@@ -271,14 +258,15 @@ module.exports = function (initPath) {
271
258
  print(colors.bold.magenta('Find more information at https://codecept.io'));
272
259
  return;
273
260
  }
274
- } else {
275
- try {
276
- generateDefinitions(testsPath, {});
277
- } catch (err) {
278
- print(colors.bold.red('Couldn\'t generate type definitions'));
279
- print(colors.red(err.toString()));
280
- print('Skipping type definitions...');
281
- }
261
+ }
262
+
263
+ try {
264
+ generateDefinitions(testsPath, {});
265
+ } catch (err) {
266
+ print(colors.bold.red('Couldn\'t generate type definitions'));
267
+ print(colors.red(err.toString()));
268
+ print('Skipping type definitions...');
269
+ print(generateDefinitionsManually);
282
270
  }
283
271
 
284
272
  print('');
package/lib/config.js CHANGED
@@ -5,6 +5,7 @@ const {
5
5
  isFile,
6
6
  deepMerge,
7
7
  deepClone,
8
+ requireWithFallback,
8
9
  } = require('./utils');
9
10
 
10
11
  const defaultConfig = {
@@ -143,6 +144,14 @@ module.exports = Config;
143
144
  function loadConfigFile(configFile) {
144
145
  const extensionName = path.extname(configFile);
145
146
 
147
+ if (extensionName === '.ts') {
148
+ try {
149
+ require('ts-node/register');
150
+ } catch (err) {
151
+ console.log('ts-node package is required to parse codecept.conf.ts config correctly');
152
+ }
153
+ }
154
+
146
155
  // .conf.js config file
147
156
  if (extensionName === '.js' || extensionName === '.ts' || extensionName === '.cjs') {
148
157
  return Config.create(require(configFile).config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.3.5-beta.1",
3
+ "version": "3.3.5-beta.2",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",