codeceptjs 4.0.1-beta.11 → 4.0.1-beta.13

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.
package/bin/codecept.js CHANGED
@@ -174,7 +174,7 @@ program
174
174
  .option('-R, --reporter <name>', 'specify the reporter to use')
175
175
  .option('-S, --sort', 'sort test files')
176
176
  .option('-b, --bail', 'bail after first test failure')
177
- .option('-d, --debug', "enable node's debugger, synonym for node --debug")
177
+ .option('--inspec', "enable node's debugger, synonym for node --debug")
178
178
  .option('-g, --grep <pattern>', 'only run tests matching <pattern>')
179
179
  .option('-f, --fgrep <string>', 'only run tests containing <string>')
180
180
  .option('-i, --invert', 'inverts --grep and --fgrep matches')
@@ -276,7 +276,7 @@ program
276
276
  .option('-R, --reporter <name>', 'specify the reporter to use')
277
277
  .option('-S, --sort', 'sort test files')
278
278
  .option('-b, --bail', 'bail after first test failure')
279
- .option('-d, --debug', "enable node's debugger, synonym for node --debug")
279
+ .option('--inspect', "enable node's debugger, synonym for node --debug")
280
280
  .option('-g, --grep <pattern>', 'only run tests matching <pattern>')
281
281
  .option('-f, --fgrep <string>', 'only run tests containing <string>')
282
282
  .option('-i, --invert', 'inverts --grep and --fgrep matches')
@@ -1389,6 +1389,29 @@ class Playwright extends Helper {
1389
1389
  }
1390
1390
  }
1391
1391
 
1392
+ // Close all contexts and pages before closing browser to prevent hanging
1393
+ if (this.browser) {
1394
+ try {
1395
+ const contexts = await Promise.race([
1396
+ this.browser.contexts(),
1397
+ new Promise((_, reject) => setTimeout(() => reject(new Error('Get contexts timeout')), 1000))
1398
+ ])
1399
+ // Close all pages in all contexts first
1400
+ await Promise.allSettled(contexts.map(async (ctx) => {
1401
+ try {
1402
+ const pages = await ctx.pages()
1403
+ await Promise.allSettled(pages.map(p => p.close().catch(() => {})))
1404
+ } catch (e) {
1405
+ // Ignore errors getting or closing pages
1406
+ }
1407
+ }))
1408
+ // Then close all contexts
1409
+ await Promise.allSettled(contexts.map(c => c.close().catch(() => {})))
1410
+ } catch (e) {
1411
+ // Ignore errors if browser is already closed or timeout getting contexts
1412
+ }
1413
+ }
1414
+
1392
1415
  if (this.options.recordHar && this.browserContext) {
1393
1416
  try {
1394
1417
  await this.browserContext.close()
@@ -142,8 +142,13 @@ const __dirname = __dirname_fn(__filename);
142
142
  }
143
143
  }
144
144
 
145
- // Try adding .ts extension if file doesn't exist and no extension provided
146
- if (!path.extname(importedPath)) {
145
+ // Check for standard module extensions to determine if we should try adding .ts
146
+ const ext = path.extname(importedPath)
147
+ const standardExtensions = ['.js', '.mjs', '.cjs', '.json', '.node']
148
+ const hasStandardExtension = standardExtensions.includes(ext.toLowerCase())
149
+
150
+ // If it doesn't end with .ts and doesn't have a standard extension, try adding .ts
151
+ if (!importedPath.endsWith('.ts') && !hasStandardExtension) {
147
152
  const tsPath = importedPath + '.ts'
148
153
  if (fs.existsSync(tsPath)) {
149
154
  importedPath = tsPath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "4.0.1-beta.11",
3
+ "version": "4.0.1-beta.13",
4
4
  "type": "module",
5
5
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
6
6
  "keywords": [
@@ -98,7 +98,7 @@
98
98
  "chalk": "4.1.2",
99
99
  "cheerio": "^1.0.0",
100
100
  "chokidar": "^4.0.3",
101
- "commander": "11.1.0",
101
+ "commander": "14.0.2",
102
102
  "cross-spawn": "7.0.6",
103
103
  "css-to-xpath": "0.1.0",
104
104
  "csstoxpath": "1.6.0",
@@ -144,7 +144,7 @@
144
144
  "@pollyjs/adapter-puppeteer": "6.0.6",
145
145
  "@pollyjs/core": "6.0.6",
146
146
  "@testomatio/reporter": "^2.3.1",
147
- "@types/chai": "5.2.2",
147
+ "@types/chai": "5.2.3",
148
148
  "@types/inquirer": "9.0.9",
149
149
  "@types/node": "^24.9.2",
150
150
  "@wdio/sauce-service": "9.12.5",
@@ -152,8 +152,8 @@
152
152
  "@wdio/utils": "9.20.0",
153
153
  "@xmldom/xmldom": "0.9.8",
154
154
  "bunosh": "latest",
155
- "chai": "^4.5.0",
156
- "chai-as-promised": "7.1.2",
155
+ "chai": "^6.2.1",
156
+ "chai-as-promised": "^8.0.2",
157
157
  "chai-subset": "1.6.0",
158
158
  "documentation": "14.0.3",
159
159
  "electron": "38.2.0",
@@ -178,7 +178,7 @@
178
178
  "runok": "^0.9.3",
179
179
  "semver": "7.7.3",
180
180
  "sinon": "21.0.0",
181
- "sinon-chai": "3.7.0",
181
+ "sinon-chai": "^4.0.1",
182
182
  "ts-morph": "27.0.2",
183
183
  "ts-node": "10.9.2",
184
184
  "tsd": "^0.33.0",