From 7710d35d8d5c12209a3d7e5a3e1de569a0a00343 Mon Sep 17 00:00:00 2001 From: Andy Edwards Date: Mon, 8 Apr 2024 21:49:09 -0500 Subject: [PATCH] fix: use async/await in built code BREAKING CHANGE: drop support for Node < 16 --- .circleci/config.yml | 2 +- .vscode/launch.json | 13 +++ .vscode/tasks.json | 59 +++++++++++++ package.json | 20 +++-- pnpm-lock.yaml | 137 ++++++++++++++++++++--------- src/assertions/attribute.js | 24 +++-- src/assertions/booleanAssertion.js | 12 ++- src/assertions/text.js | 12 ++- src/assertions/value.js | 12 ++- test/configure.js | 10 --- test/index.js | 4 +- toolchain.config.cjs | 2 +- 12 files changed, 212 insertions(+), 95 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json delete mode 100644 test/configure.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 131e0e7..ab33472 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ version: 2.1 jobs: build: docker: - - image: cimg/node:20.3.0 + - image: cimg/node:20.10.0 steps: - checkout diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0a49d62 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "test:debug ", + "port": 9229, + "request": "attach", + "skipFiles": ["/**"], + "type": "node", + "preLaunchTask": "test:debug " + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..9a4da2b --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,59 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "shell", + "options": { + "shell": { + "executable": "bash", + "args": ["-c", "-l"] + } + }, + "command": "pnpm", + "isBackground": false, + "group": "test", + "presentation": { + "panel": "dedicated", + "clear": true + }, + "label": "test ", + "args": ["tc", "test", "${file}"] + }, + { + "type": "shell", + "options": { + "shell": { + "executable": "bash", + "args": ["-c", "-l"] + } + }, + "command": "pnpm", + "isBackground": false, + "group": "test", + "presentation": { + "panel": "dedicated", + "clear": true + }, + "label": "test:watch ", + "args": ["tc", "test", "--watch", "${file}"] + }, + { + "type": "shell", + "options": { + "shell": { + "executable": "bash", + "args": ["-c", "-l"] + } + }, + "command": "pnpm", + "isBackground": false, + "group": "test", + "presentation": { + "panel": "dedicated", + "clear": true + }, + "label": "test:debug ", + "args": ["tc", "test", "-n", "inspect-brk", "${file}"] + } + ] +} diff --git a/package.json b/package.json index dea91d3..e7f0e40 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,13 @@ }, "homepage": "https://github.com/jcoreio/chai-webdriverio-async#readme", "devDependencies": { - "@jcoreio/toolchain": "^3.2.0", - "@jcoreio/toolchain-circle": "^3.2.0", - "@jcoreio/toolchain-esnext": "^3.2.0", - "@jcoreio/toolchain-mocha": "^3.2.0", - "@jcoreio/toolchain-semantic-release": "^3.2.0", - "@jcoreio/toolchain-typescript": "^3.2.0", + "@jcoreio/eslint-plugin-implicit-dependencies": "^1.1.1", + "@jcoreio/toolchain": "^3.10.1", + "@jcoreio/toolchain-circle": "^3.10.1", + "@jcoreio/toolchain-esnext": "^3.10.1", + "@jcoreio/toolchain-mocha": "^3.10.1", + "@jcoreio/toolchain-semantic-release": "^3.10.1", + "@jcoreio/toolchain-typescript": "^3.10.1", "@typescript-eslint/eslint-plugin": "^5.60.0", "@typescript-eslint/parser": "^5.60.0", "chai": "^4.3.7", @@ -39,6 +40,8 @@ "cross-env": "^5.2.0", "eslint": "^8.43.0", "eslint-config-prettier": "^3.3.0", + "eslint-plugin-no-only-tests": "^3.1.0", + "lodash": "^4.17.21", "mocha": "^10.2.0", "proxyquire": "^2.1.3", "rimraf": "^2.6.0", @@ -50,6 +53,9 @@ "dependencies": { "@babel/runtime": "^7.18.6" }, + "peerDependencies": { + "webdriverio": "*" + }, "main": "dist/index.js", "types": "dist/index.d.ts", "exports": { @@ -61,5 +67,5 @@ "engines": { "node": ">=16" }, - "packageManager": "pnpm@8.3.1" + "packageManager": "pnpm@8.11.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b43f4de..0ed7fca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,24 +10,27 @@ dependencies: version: 7.23.2 devDependencies: + '@jcoreio/eslint-plugin-implicit-dependencies': + specifier: ^1.1.1 + version: 1.1.1 '@jcoreio/toolchain': - specifier: ^3.2.0 - version: 3.2.0 + specifier: ^3.10.1 + version: 3.10.1 '@jcoreio/toolchain-circle': - specifier: ^3.2.0 - version: 3.2.0 + specifier: ^3.10.1 + version: 3.10.1 '@jcoreio/toolchain-esnext': - specifier: ^3.2.0 - version: 3.2.0(@jcoreio/toolchain@3.2.0) + specifier: ^3.10.1 + version: 3.10.1 '@jcoreio/toolchain-mocha': - specifier: ^3.2.0 - version: 3.2.0(@jcoreio/toolchain@3.2.0) + specifier: ^3.10.1 + version: 3.10.1 '@jcoreio/toolchain-semantic-release': - specifier: ^3.2.0 - version: 3.2.0(typescript@5.2.2) + specifier: ^3.10.1 + version: 3.10.1(typescript@5.2.2) '@jcoreio/toolchain-typescript': - specifier: ^3.2.0 - version: 3.2.0(@babel/core@7.23.2)(@jcoreio/toolchain-esnext@3.2.0)(@jcoreio/toolchain@3.2.0)(eslint@8.53.0)(typescript@5.2.2) + specifier: ^3.10.1 + version: 3.10.1(eslint@8.53.0)(typescript@5.2.2) '@typescript-eslint/eslint-plugin': specifier: ^5.60.0 version: 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.53.0)(typescript@5.2.2) @@ -52,6 +55,12 @@ devDependencies: eslint-config-prettier: specifier: ^3.3.0 version: 3.6.0(eslint@8.53.0) + eslint-plugin-no-only-tests: + specifier: ^3.1.0 + version: 3.1.0 + lodash: + specifier: ^4.17.21 + version: 4.17.21 mocha: specifier: ^10.2.0 version: 10.2.0 @@ -1450,22 +1459,31 @@ packages: engines: {node: '>=8'} dev: true - /@jcoreio/toolchain-circle@3.2.0: - resolution: {integrity: sha512-m9VjVhlXN7WGBl480kXWEgTLW+HxG6+5y8HpjeA+3TuOsnrc0Ep3Jpt8dvkiFL6mNpMt5wEdS+/6pozYldDc4A==} + /@jcoreio/eslint-plugin-implicit-dependencies@1.1.1: + resolution: {integrity: sha512-Kg+erBdnA1sczSNNGEGIA9k7hwfnN1NrKEnACfJwbGoR6T5E/yhBbpyF5q5dEIvxHTUJ4wL5azEd3m68qq8F+Q==} + engines: {node: '>=16'} + dependencies: + '@babel/runtime': 7.23.2 + '@types/validate-npm-package-name': 4.0.2 + pkg-up: 3.1.0 + validate-npm-package-name: 5.0.0 + dev: true + + /@jcoreio/toolchain-circle@3.10.1: + resolution: {integrity: sha512-yX3HO81SGcbRf1ZsUNy49iTfvHPFpjFIfrS448LXMLko4LyNxgFAPii41+6UVK467LR0JOKiKAABscGazmT6vg==} dependencies: - '@jcoreio/toolchain': 3.2.0 + '@jcoreio/toolchain': 3.10.1 dedent-js: 1.0.1 open: 8.4.2 + semver: 7.5.4 transitivePeerDependencies: - enquirer - supports-color dev: true - /@jcoreio/toolchain-esnext@3.2.0(@jcoreio/toolchain@3.2.0): - resolution: {integrity: sha512-+Vp4kUXXKe6bp4cbBo2cNo4b9RtO5XPrmNIJVsBLvVzhHt0umhvZ3UprSUrV/ogbpgoaQKWkEejL5hgo2eRkFQ==} + /@jcoreio/toolchain-esnext@3.10.1: + resolution: {integrity: sha512-ROxTZtKgMuWOtMGdf0h9gn2arQXV4ZzONnhLG7jKa2JoxZ3ewKVFVMf7PbmyjFKIIswx92e+cUufIYalJyZNRg==} hasBin: true - peerDependencies: - '@jcoreio/toolchain': 3.2.0 dependencies: '@babel/cli': 7.23.0(@babel/core@7.23.2) '@babel/core': 7.23.2 @@ -1476,40 +1494,42 @@ packages: '@babel/register': 7.22.15(@babel/core@7.23.2) '@babel/runtime': 7.23.2 '@babel/traverse': 7.23.2 - '@jcoreio/toolchain': 3.2.0 + '@jcoreio/toolchain': 3.10.1 babel-parse-wild-code: 2.1.5 babel-plugin-add-module-exports: 1.0.4 babel-plugin-istanbul: 6.1.1 + babel-register-esm: 1.2.5(@babel/core@7.23.2) dedent-js: 1.0.1 eslint: 8.53.0 fs-extra: 10.1.0 - glob: 7.2.3 resolve: 1.22.8 resolve-bin: 1.0.1 transitivePeerDependencies: + - enquirer - supports-color dev: true - /@jcoreio/toolchain-mocha@3.2.0(@jcoreio/toolchain@3.2.0): - resolution: {integrity: sha512-Q/FtKqQ/2y4JqNVTwL4CIQs8tb6HOlyaIasFtQ+d4P0xc2iMrZVCBi9ZYEddis+V3IHpvHSGBGAtd36eZLrQTA==} + /@jcoreio/toolchain-mocha@3.10.1: + resolution: {integrity: sha512-U07HFzeRe2RRM4AS9Y3vgtVWJv3fPgVPnsP3DfAzjhcMR70dx8wp2RbTyXkLx8AL/MH5e+cZsLql4lp4u0VHdw==} hasBin: true - peerDependencies: - '@jcoreio/toolchain': 3.2.0 dependencies: - '@jcoreio/toolchain': 3.2.0 + '@jcoreio/toolchain': 3.10.1 + babel-plugin-istanbul: 6.1.1 dedent-js: 1.0.1 + eslint-plugin-no-only-tests: 3.1.0 mocha: 10.2.0 nyc: 15.1.0 resolve-bin: 1.0.1 transitivePeerDependencies: + - enquirer - supports-color dev: true - /@jcoreio/toolchain-semantic-release@3.2.0(typescript@5.2.2): - resolution: {integrity: sha512-d8ZZiYT6nBU/RCKaQI3To7Yn1Efa5pcNbedzCVEQRhZg7GPdz9pAhRaEk3HmSLPymYO/f5bQyAWwn5hoWAw4vQ==} + /@jcoreio/toolchain-semantic-release@3.10.1(typescript@5.2.2): + resolution: {integrity: sha512-ZFjO7Ocm+sGReeYBP4sU8Rx4m31iLuxR09zt46X4VbyTSWVY5kvyy3dz11sP5MZ6+jjthXTzHj+Ci24J5dcO/w==} hasBin: true dependencies: - '@jcoreio/toolchain': 3.2.0 + '@jcoreio/toolchain': 3.10.1 '@semantic-release/commit-analyzer': 9.0.2(semantic-release@21.1.2) '@semantic-release/github': 8.1.0(semantic-release@21.1.2) '@semantic-release/npm': 10.0.6(semantic-release@21.1.2) @@ -1524,32 +1544,30 @@ packages: - typescript dev: true - /@jcoreio/toolchain-typescript@3.2.0(@babel/core@7.23.2)(@jcoreio/toolchain-esnext@3.2.0)(@jcoreio/toolchain@3.2.0)(eslint@8.53.0)(typescript@5.2.2): - resolution: {integrity: sha512-4nCiD052yMIc3MkcAT4wmT0BkY1sqxty8pBItpqT8/+8qVgbimuFaSmTY0Y6rR1OI8YMKF6ioX6D2X6Irz5xmQ==} + /@jcoreio/toolchain-typescript@3.10.1(eslint@8.53.0)(typescript@5.2.2): + resolution: {integrity: sha512-dqoBA6AKXKYuEAefgUavbJG0C/sogq9yzZ7OgtcQ/Hbe8LZjFlE3AqJte5/vnvakjDJqScWl2sKf9bnxVWVPTA==} peerDependencies: - '@babel/core': ^7.0.0 - '@jcoreio/toolchain': 3.2.0 - '@jcoreio/toolchain-esnext': 3.2.0 - eslint: ^8.43.0 typescript: ^5.1.0 dependencies: '@babel/core': 7.23.2 '@babel/preset-typescript': 7.23.2(@babel/core@7.23.2) - '@jcoreio/toolchain': 3.2.0 - '@jcoreio/toolchain-esnext': 3.2.0(@jcoreio/toolchain@3.2.0) + '@jcoreio/toolchain': 3.10.1 + '@jcoreio/toolchain-esnext': 3.10.1 '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.53.0)(typescript@5.2.2) '@typescript-eslint/parser': 5.62.0(eslint@8.53.0)(typescript@5.2.2) - eslint: 8.53.0 json5: 2.2.3 typescript: 5.2.2 transitivePeerDependencies: + - enquirer + - eslint - supports-color dev: true - /@jcoreio/toolchain@3.2.0: - resolution: {integrity: sha512-HKUt/Ac3RXtDdk6PBpdF12KzxUYEXgNJ/zN+kIV9H1scEbmBp+ws2KvgBv0RfaverBvk11vyCPtqzDUbQ9CFzg==} + /@jcoreio/toolchain@3.10.1: + resolution: {integrity: sha512-d4ejq5ahA3LStGlWtkZvgTZVnWZ9ibbNyi6krx8GxjO/Q9QUQE22wPSZG3M4MLu8cps2kyObtIqbVheTQDwTsA==} hasBin: true dependencies: + '@jcoreio/eslint-plugin-implicit-dependencies': 1.1.1 chalk: 4.1.2 dedent-js: 1.0.1 eslint: 8.53.0 @@ -1557,6 +1575,7 @@ packages: execa: 5.1.1 find-up: 5.0.0 fs-extra: 10.1.0 + glob: 7.2.3 json5: 2.2.3 lint-staged: 12.5.0 lodash: 4.17.21 @@ -2095,6 +2114,10 @@ packages: resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} dev: true + /@types/validate-npm-package-name@4.0.2: + resolution: {integrity: sha512-lrpDziQipxCEeK5kWxvljWYhUvOiB2A9izZd9B2AFarYAkqZshb4lPbRs7zKEic6eGtH8V/2qJW+dPp9OtF6bw==} + dev: true + /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.53.0)(typescript@5.2.2): resolution: {integrity: sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2623,6 +2646,15 @@ packages: - supports-color dev: true + /babel-register-esm@1.2.5(@babel/core@7.23.2): + resolution: {integrity: sha512-WaVd3Rm42kndYnufn8u1SbUUwuCxL2GAQX/7QXUL3w/7PffB+HcXrzmAqk1x01TjhFh/npSZ9Z3MNBc6dDb6Uw==} + engines: {node: '>=12.17.0'} + peerDependencies: + '@babel/core': '*' + dependencies: + '@babel/core': 7.23.2 + dev: true + /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} dev: true @@ -2713,6 +2745,12 @@ packages: ieee754: 1.2.1 dev: true + /builtins@5.1.0: + resolution: {integrity: sha512-SW9lzGTLvWTP1AY8xeAMZimqDrIaSdLQUcVr9DMef51niJ022Ri87SwRRKYm4A6iHfkPaiVUu/Duw2Wc4J7kKg==} + dependencies: + semver: 7.5.4 + dev: true + /caching-transform@4.0.0: resolution: {integrity: sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==} engines: {node: '>=8'} @@ -3547,6 +3585,11 @@ packages: eslint: 8.53.0 dev: true + /eslint-plugin-no-only-tests@3.1.0: + resolution: {integrity: sha512-Lf4YW/bL6Un1R6A76pRZyE1dl1vr31G/ev8UzIc/geCgFWyrKil8hVjYqWVKGB/UIGmb6Slzs9T0wNezdSVegw==} + engines: {node: '>=5.0.0'} + dev: true + /eslint-scope@5.1.1: resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} engines: {node: '>=8.0.0'} @@ -6148,6 +6191,13 @@ packages: find-up: 4.1.0 dev: true + /pkg-up@3.1.0: + resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==} + engines: {node: '>=8'} + dependencies: + find-up: 3.0.0 + dev: true + /prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -7418,6 +7468,13 @@ packages: spdx-expression-parse: 3.0.1 dev: true + /validate-npm-package-name@5.0.0: + resolution: {integrity: sha512-YuKoXDAhBYxY7SfOKxHBDoSyENFeW5VvIIQp2TGQuit8gpK6MnWaQelBKxso72DoxTZfZdcP3W90LqpSkgPzLQ==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + dependencies: + builtins: 5.1.0 + dev: true + /verror@1.10.0: resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} engines: {'0': node >=0.6.0} diff --git a/src/assertions/attribute.js b/src/assertions/attribute.js index 5af33f4..2e79f0d 100644 --- a/src/assertions/attribute.js +++ b/src/assertions/attribute.js @@ -15,13 +15,11 @@ const attribute = (client, chai, utils, options) => client ) if (arguments.length === 1) { - if (!elements.length) { - throw new chai.AssertionError( - negate - ? `Expected element <${selector}> to not have attribute ${attribute}, but no matching elements were found` - : `Expected element <${selector}> to have attribute ${attribute}, but no matching elements were found` - ) - } + this.assert( + negate ^ (elements.length > 0), + `Expected element <${selector}> to have attribute ${attribute}, but no matching elements were found`, + `Expected element <${selector}> to not have attribute ${attribute}, but no matching elements were found` + ) const values = [] const filteredList = ( @@ -49,13 +47,11 @@ const attribute = (client, chai, utils, options) => const expectedStr = typeof expected === 'string' ? JSON.stringify(expected) : expected - if (!elements.length) { - throw new chai.AssertionError( - negate - ? `Expected element <${selector}> to not have attribute ${attribute} with value ${expectedStr}, but no matching elements were found` - : `Expected element <${selector}> to have attribute ${attribute} with value ${expectedStr}, but no matching elements were found` - ) - } + this.assert( + negate ^ (elements.length > 0), + `Expected element <${selector}> to have attribute ${attribute} with value ${expectedStr}, but no matching elements were found`, + `Expected element <${selector}> to not have attribute ${attribute} with value ${expectedStr}, but no matching elements were found` + ) const values = [] const filteredList = ( diff --git a/src/assertions/booleanAssertion.js b/src/assertions/booleanAssertion.js index 6e4518d..d5f790e 100644 --- a/src/assertions/booleanAssertion.js +++ b/src/assertions/booleanAssertion.js @@ -16,13 +16,11 @@ const booleanAssertion = utils.flag(this, 'object'), client ) - if (!allowNone && !elements.length) { - throw new chai.AssertionError( - negate - ? `Expected element <${selector}> to not be ${expectation} but no matching elements were found` - : `Expected element <${selector}> to be ${expectation} but no matching elements were found` - ) - } + this.assert( + negate ^ (allowNone || elements.length > 0), + `Expected element <${selector}> to be ${expectation} but no matching elements were found`, + `Expected element <${selector}> to not be ${expectation} but no matching elements were found` + ) const filteredList = (await Promise.all(elements.map(predicate))).filter( Boolean diff --git a/src/assertions/text.js b/src/assertions/text.js index f2bb5ba..ea6731c 100644 --- a/src/assertions/text.js +++ b/src/assertions/text.js @@ -16,13 +16,11 @@ const text = (client, chai, utils, options) => { const expectedStr = typeof expected === 'string' ? JSON.stringify(expected) : expected - if (!texts.length) { - throw new chai.AssertionError( - negate - ? `Expected element <${selector}> to not have text ${expectedStr}, but no matching elements were found` - : `Expected element <${selector}> to have text ${expectedStr}, but no matching elements were found` - ) - } + this.assert( + negate ^ (texts.length > 0), + `Expected element <${selector}> to have text ${expectedStr}, but no matching elements were found`, + `Expected element <${selector}> to not have text ${expectedStr}, but no matching elements were found` + ) const filteredList = texts.filter((text) => expected instanceof RegExp ? text.match(expected) : text === expected diff --git a/src/assertions/value.js b/src/assertions/value.js index 417cff7..b4d0082 100644 --- a/src/assertions/value.js +++ b/src/assertions/value.js @@ -16,13 +16,11 @@ const value = (client, chai, utils, options) => { const expectedStr = typeof expected === 'string' ? JSON.stringify(expected) : expected - if (!values.length) { - throw new chai.AssertionError( - negate - ? `Expected element <${selector}> to not have value ${expectedStr}, but no matching elements were found` - : `Expected element <${selector}> to have value ${expectedStr}, but no matching elements were found` - ) - } + this.assert( + negate ^ (values.length > 0), + `Expected element <${selector}> to have value ${expectedStr}, but no matching elements were found`, + `Expected element <${selector}> to not have value ${expectedStr}, but no matching elements were found` + ) const filteredList = values.filter((value) => expected instanceof RegExp ? value.match(expected) : value === expected diff --git a/test/configure.js b/test/configure.js deleted file mode 100644 index 5e45a96..0000000 --- a/test/configure.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-env node */ - -import { before } from 'mocha' -import chai from 'chai' -import asPromised from 'chai-as-promised' -chai.use(asPromised) - -if (process.argv.indexOf('--watch') >= 0) { - before(() => process.stdout.write('\u001b[2J\u001b[1;1H\u001b[3J')) -} diff --git a/test/index.js b/test/index.js index 2fe1ef3..793a230 100644 --- a/test/index.js +++ b/test/index.js @@ -1,8 +1,10 @@ import chai, { expect } from 'chai' +import chaiAsPromised from 'chai-as-promised' import fakeClient from './stubs/fakeClient' import { beforeEach, describe, it } from 'mocha' import chaiWebdriverio from '../src' - +chai.config.includeStack = true +chai.use(chaiAsPromised) chai.use(chaiWebdriverio(fakeClient)) beforeEach(() => { diff --git a/toolchain.config.cjs b/toolchain.config.cjs index 93784a3..ca7c1e8 100644 --- a/toolchain.config.cjs +++ b/toolchain.config.cjs @@ -1,5 +1,5 @@ /* eslint-env node, es2018 */ module.exports = { - cjsBabelEnv: { forceAllTransforms: true }, + cjsBabelEnv: { targets: { node: 16 } }, outputEsm: false, }