Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/webdriver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
SELENIUM_HOST: localhost
SELENIUM_PORT: 4444
- name: run unit tests
run: ./node_modules/.bin/mocha test/helper/WebDriver_test.js --exit --reporter @testomatio/reporter/mocha
run: ./node_modules/.bin/mocha test/helper/WebDriver_test.js --exit
timeout-minutes: 10
env:
SELENIUM_HOST: localhost
Expand Down
26 changes: 13 additions & 13 deletions Bunoshfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,21 +715,21 @@ export async function prettier() {
* Run unit tests.
*/
export async function testUnit() {
await shell`mocha test/unit --recursive --timeout 10000 --reporter @testomatio/reporter/mocha`
await shell`mocha test/unit --recursive --timeout 10000`
}

/**
* Run REST tests.
*/
export async function testRest() {
await shell`mocha test/rest --recursive --timeout 20000 --reporter @testomatio/reporter/mocha`
await shell`mocha test/rest --recursive --timeout 20000`
}

/**
* Run runner tests.
*/
export async function testRunner() {
await shell`mocha test/runner --recursive --timeout 10000 --reporter @testomatio/reporter/mocha`
await shell`mocha test/runner --recursive --timeout 10000`
}

/**
Expand All @@ -755,28 +755,28 @@ export async function testWithMockServer() {
* Run quick Appium tests.
*/
export async function testAppiumQuick() {
await shell`mocha test/helper/Appium_test.js --grep 'quick' --reporter @testomatio/reporter/mocha`
await shell`mocha test/helper/Appium_test.js --grep 'quick'`
}

/**
* Run the remaining (second) Appium tests.
*/
export async function testAppiumOther() {
await shell`mocha test/helper/Appium_test.js --grep 'second' --reporter @testomatio/reporter/mocha`
await shell`mocha test/helper/Appium_test.js --grep 'second'`
}

/**
* Run quick iOS Appium tests.
*/
export async function testIosAppiumQuick() {
await shell`mocha test/helper/Appium_ios_test.js --grep 'quick' --reporter @testomatio/reporter/mocha`
await shell`mocha test/helper/Appium_ios_test.js --grep 'quick'`
}

/**
* Run the remaining (second) iOS Appium tests.
*/
export async function testIosAppiumOther() {
await shell`mocha test/helper/Appium_ios_test.js --grep 'second' --reporter @testomatio/reporter/mocha`
await shell`mocha test/helper/Appium_ios_test.js --grep 'second'`
}

/**
Expand All @@ -797,42 +797,42 @@ export async function testAppStop() {
* Run Playwright helper unit tests.
*/
export async function testWebapiPlaywright() {
await shell`mocha test/helper/Playwright_test.js --reporter @testomatio/reporter/mocha`
await shell`mocha test/helper/Playwright_test.js`
}

/**
* Run Puppeteer helper unit tests.
*/
export async function testWebapiPuppeteer() {
await shell`mocha test/helper/Puppeteer_test.js --reporter @testomatio/reporter/mocha`
await shell`mocha test/helper/Puppeteer_test.js`
}

/**
* Run WebDriver helper unit tests.
*/
export async function testWebapiWebdriver() {
await shell`mocha test/helper/WebDriver_test.js --timeout 10000 --reporter @testomatio/reporter/mocha`
await shell`mocha test/helper/WebDriver_test.js --timeout 10000`
}

/**
* Run WebDriver helper unit tests without a Selenium server.
*/
export async function testWebapiWebdriverNoSelenium() {
await shell`mocha test/helper/WebDriver.noSeleniumServer_test.js --timeout 10000 --reporter @testomatio/reporter/mocha`
await shell`mocha test/helper/WebDriver.noSeleniumServer_test.js --timeout 10000`
}

/**
* Run Expect helper unit tests.
*/
export async function testExpect() {
await shell`mocha test/helper/Expect_test.js --reporter @testomatio/reporter/mocha`
await shell`mocha test/helper/Expect_test.js`
}

/**
* Run plugin tests.
*/
export async function testPlugin() {
await shell`mocha test/plugin/plugin_test.js --reporter @testomatio/reporter/mocha`
await shell`mocha test/plugin/plugin_test.js`
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/mocha/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mocha from 'mocha'
const { reporters: { Base } } = mocha
import { reporters } from 'mocha'
const { Base } = reporters
import ms from 'ms'
import figures from 'figures'
import { readFileSync } from 'fs'
Expand Down
3 changes: 1 addition & 2 deletions lib/mocha/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Suite from 'mocha/lib/suite.js'
import Test from 'mocha/lib/test.js'
import { Suite, Test } from 'mocha'
import { BeforeHook, AfterHook, BeforeSuiteHook, AfterSuiteHook } from './hooks.js'

export {
Expand Down
2 changes: 1 addition & 1 deletion lib/mocha/suite.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MochaSuite from 'mocha/lib/suite.js'
import { Suite as MochaSuite } from 'mocha'
/**
* @typedef {import('mocha')} Mocha
*/
Expand Down
3 changes: 1 addition & 2 deletions lib/mocha/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Test from 'mocha/lib/test.js'
import Suite from 'mocha/lib/suite.js'
import { Suite, Test } from 'mocha'
import { genTestId, serializeError, clearString, relativeDir } from '../utils.js'
import Step from '../step/base.js'
import { enhanceMochaSuite } from './suite.js'
Expand Down
6 changes: 3 additions & 3 deletions lib/mocha/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createTest } from './test.js'
import { createSuite } from './suite.js'
import { HookConfig, AfterSuiteHook, AfterHook, BeforeSuiteHook, BeforeHook } from './hooks.js'
import { initMochaGlobals } from '../globals.js'
import common from 'mocha/lib/interfaces/common.js'
import { createCommon } from 'mocha/lib/interfaces/common.js'
import container from '../container.js'
import store from '../store.js'

Expand Down Expand Up @@ -49,7 +49,7 @@ export default function (suite) {
let afterEachHooksAreLoaded

suite.on('pre-require', (context, file, mocha) => {
const cmn = common(suites, context, mocha)
const cmn = createCommon(suites, context, mocha)

const addScenario = function (title, opts = {}, fn) {
const suite = suites[0]
Expand All @@ -74,7 +74,7 @@ export default function (suite) {
context.BeforeAll = cmn.before
context.AfterAll = cmn.after

context.run = mocha.options.delay && common.runWithSuite(suite)
context.run = mocha.options.delay && cmn.runWithSuite(suite)
/**
* Describe a "suite" with the given `title`
* and callback `fn` containing nested suites
Expand Down
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,26 @@
"lint-fix": "eslint bin/ examples/ lib/ test/ translations/ runok.cjs --fix",
"prettier": "prettier --config prettier.config.js --write bin/**/*.js lib/**/*.js test/**/*.js translations/**/*.js runok.cjs",
"docs": "./runok.cjs docs",
"test:unit": "mocha test/unit --recursive --timeout 10000 --reporter @testomatio/reporter/mocha",
"test:unit:windows": "mocha test/unit/container_test.js --recursive --timeout 10000 --reporter @testomatio/reporter/mocha",
"test:rest": "mocha test/rest --recursive --timeout 20000 --reporter @testomatio/reporter/mocha",
"test:runner": "mocha test/runner --recursive --timeout 10000 --reporter @testomatio/reporter/mocha",
"test:unit": "mocha test/unit --recursive --timeout 10000",
"test:unit:windows": "mocha test/unit/container_test.js --recursive --timeout 10000",
"test:rest": "mocha test/rest --recursive --timeout 20000",
"test:runner": "mocha test/runner --recursive --timeout 10000",
"test": "npm run test:unit && npm run test:rest && npm run test:runner",
"test:appium-quick": "mocha test/helper/Appium_test.js --grep 'quick' --reporter @testomatio/reporter/mocha",
"test:appium-other": "mocha test/helper/Appium_test.js --grep 'second' --reporter @testomatio/reporter/mocha",
"test:ios:appium-quick": "mocha test/helper/Appium_ios_test.js --grep 'quick' --reporter @testomatio/reporter/mocha",
"test:ios:appium-other": "mocha test/helper/Appium_ios_test.js --grep 'second' --reporter @testomatio/reporter/mocha",
"test:appium-quick": "mocha test/helper/Appium_test.js --grep 'quick'",
"test:appium-other": "mocha test/helper/Appium_test.js --grep 'second'",
"test:ios:appium-quick": "mocha test/helper/Appium_ios_test.js --grep 'quick'",
"test:ios:appium-other": "mocha test/helper/Appium_ios_test.js --grep 'second'",
"test-app:start": "php -S 127.0.0.1:8000 -t test/data/app",
"test-app:stop": "kill -9 $(lsof -t -i:8000)",
"test:unit:webbapi:playwright": "mocha test/helper/Playwright_test.js --reporter @testomatio/reporter/mocha",
"test:unit:webbapi:puppeteer": "mocha test/helper/Puppeteer_test.js --reporter @testomatio/reporter/mocha",
"test:unit:webbapi:webDriver": "mocha test/helper/WebDriver_test.js --timeout 10000 --reporter @testomatio/reporter/mocha",
"test:unit:webbapi:webDriver:noSeleniumServer": "mocha test/helper/WebDriver.noSeleniumServer_test.js --timeout 10000 --reporter @testomatio/reporter/mocha",
"test:unit:webbapi:cdpbrowser": "mocha test/helper/CDPBrowser_chrome_test.js --timeout 30000 --reporter @testomatio/reporter/mocha",
"test:unit:webbapi:obscura": "mocha test/helper/CDPBrowser_obscura_test.js --timeout 30000 --reporter @testomatio/reporter/mocha",
"test:unit:webbapi:lightpanda": "mocha test/helper/CDPBrowser_lightpanda_test.js --timeout 30000 --reporter @testomatio/reporter/mocha",
"test:unit:expect": "mocha test/helper/Expect_test.js --reporter @testomatio/reporter/mocha",
"test:plugin": "mocha test/plugin/plugin_test.js --reporter @testomatio/reporter/mocha",
"test:unit:webbapi:playwright": "mocha test/helper/Playwright_test.js",
"test:unit:webbapi:puppeteer": "mocha test/helper/Puppeteer_test.js",
"test:unit:webbapi:webDriver": "mocha test/helper/WebDriver_test.js --timeout 10000",
"test:unit:webbapi:webDriver:noSeleniumServer": "mocha test/helper/WebDriver.noSeleniumServer_test.js --timeout 10000",
"test:unit:webbapi:cdpbrowser": "mocha test/helper/CDPBrowser_chrome_test.js --timeout 30000",
"test:unit:webbapi:obscura": "mocha test/helper/CDPBrowser_obscura_test.js --timeout 30000",
"test:unit:webbapi:lightpanda": "mocha test/helper/CDPBrowser_lightpanda_test.js --timeout 30000",
"test:unit:expect": "mocha test/helper/Expect_test.js",
"test:plugin": "mocha test/plugin/plugin_test.js",
"def": "./runok.cjs def",
"dev:graphql": "node test/data/graphql/index.js",
"publish:site": "./runok.cjs publish:site",
Expand All @@ -100,11 +100,11 @@
"@cucumber/gherkin": "38.0.0",
"@cucumber/messages": "32.3.1",
"@modelcontextprotocol/sdk": "^1.26.0",
"@xmldom/xmldom": "0.9.10",
"@xmldom/xmldom": "^0.9.12",
"acorn": "8.15.0",
"ai": "7.0.132",
"arrify": "3.0.0",
"axios": "1.16.1",
"axios": "^1.20.0",
"chalk": "4.1.2",
"cheerio": "^1.0.0",
"chokidar": "^5.0.0",
Expand All @@ -127,7 +127,7 @@
"lodash.merge": "4.6.2",
"lodash.shuffle": "4.2.0",
"mkdirp": "3.0.1",
"mocha": "11.7.5",
"mocha": "^12.0.3",
"monocart-coverage-reports": "2.12.12",
"ms": "2.1.3",
"multer": "^2.0.2",
Expand Down Expand Up @@ -160,7 +160,7 @@
"@wdio/sauce-service": "9.12.5",
"@wdio/selenium-standalone-service": "8.15.0",
"@wdio/utils": "9.23.3",
"@xmldom/xmldom": "0.9.10",
"@xmldom/xmldom": "^0.9.12",
"bunosh": "latest",
"chai": "^6.2.1",
"chai-as-promised": "^8.0.2",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/circular_reference_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai'
import { safeStringify, truncateString } from '../../lib/utils.js'
import { createTest } from '../../lib/mocha/test.js'
import { createSuite } from '../../lib/mocha/suite.js'
import MochaSuite from 'mocha/lib/suite.js'
import { Suite as MochaSuite } from 'mocha'

describe('Circular Reference Handling', function () {
describe('safeStringify utility', function () {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/data/ui_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai'
import Mocha from 'mocha/lib/mocha.js'
import Suite from 'mocha/lib/suite.js'
import Mocha from 'mocha'
import { Suite } from 'mocha'
import makeUI from '../../../lib/mocha/ui.js'
import addData from '../../../lib/data/context.js'
import DataTable from '../../../lib/data/table.js'
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mocha/retry_integration_test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai'
import { createTest } from '../../../lib/mocha/test.js'
import { createSuite } from '../../../lib/mocha/suite.js'
import MochaSuite from 'mocha/lib/suite.js'
import { Suite as MochaSuite } from 'mocha'
import retryEnhancer from '../../../lib/listener/retryEnhancer.js'
import event from '../../../lib/event.js'

Expand Down
4 changes: 2 additions & 2 deletions test/unit/mocha/test_clone_test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from 'chai'
import { createTest, cloneTest } from '../../../lib/mocha/test.js'
import { createSuite } from '../../../lib/mocha/suite.js'
import MochaSuite from 'mocha/lib/suite.js'
import Test from 'mocha/lib/test.js'
import { Suite as MochaSuite } from 'mocha'
import { Test } from 'mocha'
import retryEnhancer from '../../../lib/listener/retryEnhancer.js'
import event from '../../../lib/event.js'

Expand Down
4 changes: 2 additions & 2 deletions test/unit/mocha/ui_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai'
import Mocha from 'mocha/lib/mocha.js'
import Suite from 'mocha/lib/suite.js'
import Mocha from 'mocha'
import { Suite } from 'mocha'
import { createTest } from '../../../lib/mocha/test.js'
import codeceptjs from '../../../lib/index.js'
import makeUI from '../../../lib/mocha/ui.js'
Expand Down
Loading