Skip to content

Commit

Permalink
chore(deps): bump chai from 4.3.8 to 5.0.3 (#4174)
Browse files Browse the repository at this point in the history
* chore(deps): bump chai from 4.3.8 to 5.0.3

Bumps [chai](https://github.com/chaijs/chai) from 4.3.8 to 5.0.3.
- [Release notes](https://github.com/chaijs/chai/releases)
- [Changelog](https://github.com/chaijs/chai/blob/main/History.md)
- [Commits](chaijs/chai@v4.3.8...v5.0.3)

---
updated-dependencies:
- dependency-name: chai
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix: load esm lib

* fix: load esm lib

* fix: docs

* fix: install packages

* fix: install packages

* fix: cannot start UTs

* fix: cannot start UTs

* fix: UTs

* fix: UTs

* fix: UTs

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: kobenguyent <[email protected]>
  • Loading branch information
dependabot[bot] and kobenguyent authored Feb 6, 2024
1 parent 25806cb commit 6827822
Show file tree
Hide file tree
Showing 62 changed files with 276 additions and 125 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Go over the steps in [this](https://github.com/firstcontributions/first-contribu
To start you need:

1. Fork and clone the repo.
2. Run `npm install --legacy-peer-deps --omit=optional` to install all required libraries
2. Run `npm i --force --omit=optional` to install all required libraries
3. Do the changes.
4. Add/Update Test (if possible)
5. Update documentation
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/appiumV2_Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install --legacy-peer-deps
- run: npm i --force
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/appiumV2_iOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install --legacy-peer-deps
- run: npm i --force
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm install --legacy-peer-deps
run: npm i --force

- name: Configure git user
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dtslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install --legacy-peer-deps
- run: npm i --force
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/expectHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: npm i --legacy-peer-deps
run: npm i --force
- name: run unit tests
run: ./node_modules/.bin/mocha test/helper/Expect_test.js --timeout 5000
2 changes: 1 addition & 1 deletion .github/workflows/mockServerHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: npm i --legacy-peer-deps
run: npm i --force
- name: run unit tests
run: npm run test:unit:mockServer
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
php-version: 7.4
- name: npm install
run: |
npm install --legacy-peer-deps
npm i --force
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
- name: Install browsers and deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
php-version: 7.4
- name: npm install
run: |
npm install --legacy-peer-deps
npm i --force
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
- name: Install browsers and deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/puppeteer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
php-version: 7.4
- name: npm install
run: |
npm install --legacy-peer-deps && npm i puppeteer --legacy-peer-deps
npm i --force && npm i puppeteer --force
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
- name: start a server
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testcafe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
php-version: 7.4
- name: npm install
run: |
npm install --legacy-peer-deps
npm i --force
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webdriver.devtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
php-version: 8.0
- name: npm install
run: |
npm install --legacy-peer-deps
npm i --force
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webdriver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
php-version: 8.0
- name: npm install
run: |
npm install --legacy-peer-deps
npm i --force
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
COPY . /codecept

RUN chown -R pptruser:pptruser /codecept
RUN runuser -l pptruser -c 'npm install --legacy-peer-deps --loglevel=warn --prefix /codecept'
RUN runuser -l pptruser -c 'npm i --force --loglevel=warn --prefix /codecept'

RUN ln -s /codecept/bin/codecept.js /usr/local/bin/codeceptjs
RUN mkdir /tests
Expand Down
4 changes: 2 additions & 2 deletions docs/pageobjects.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Scenario('sample test', ({ I, myPage, mySteps }) => {

## Actor

During initialization you were asked to create a custom steps file. If you accepted this option, you are now able to use the `custom_steps.js` file to extend `I`. See how the `login` method can be added to `I`:
During initialization, you were asked to create a custom steps file. If you accepted this option, you are now able to use the `custom_steps.js` file to extend `I`. See how the `login` method can be added to `I`:

```js
module.exports = function() {
Expand Down Expand Up @@ -153,7 +153,7 @@ Scenario('login2', async ({ I, loginPage, basePage }) => {
});
```

Page Objects can be be functions, arrays or classes. When declared as classes you can easily extend them in other page objects.
Page Objects can be functions, arrays or classes. When declared as classes you can easily extend them in other page objects.

Here is an example of declaring page object as a class:

Expand Down
17 changes: 10 additions & 7 deletions lib/helper/Expect.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
const chai = require('chai');
const output = require('../output');

const { expect } = chai;
let expect;

chai.use(require('chai-string'));
// @ts-ignore
chai.use(require('chai-exclude'));
chai.use(require('chai-match-pattern'));
import('chai').then(chai => {
expect = chai.expect;
chai.use(require('chai-string'));
// @ts-ignore
chai.use(require('chai-exclude'));
chai.use(require('chai-match-pattern'));
chai.use(require('chai-json-schema'));
});

/**
* This helper allows performing assertions based on Chai.
Expand Down Expand Up @@ -179,7 +182,7 @@ class ExpectHelper {
expectJsonSchema(targetData, jsonSchema, customErrorMsg = '') {
// @ts-ignore
output.step(`I expect "${JSON.stringify(targetData)}" to match this JSON schema "${JSON.stringify(jsonSchema)}"`);
chai.use(require('chai-json-schema'));

return expect(targetData, customErrorMsg).to.be.jsonSchema(jsonSchema);
}

Expand Down
16 changes: 8 additions & 8 deletions lib/helper/JSONResponse.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const assert = require('assert');
const chai = require('chai');
const joi = require('joi');
const chaiDeepMatch = require('chai-deep-match');
const Helper = require('@codeceptjs/helper');

chai.use(chaiDeepMatch);
let expect;

import('chai').then(chai => {
expect = chai.expect;
chai.use(require('chai-deep-match'));
});

const { expect } = chai;
const joi = require('joi');

/**
* This helper allows performing assertions on JSON responses paired with following helpers:
Expand Down Expand Up @@ -91,7 +92,6 @@ class JSONResponse extends Helper {
static _checkRequirements() {
try {
require('joi');
require('chai');
} catch (e) {
return ['joi'];
}
Expand Down Expand Up @@ -194,7 +194,7 @@ class JSONResponse extends Helper {
fails++;
}
}
assert.ok(fails < this.response.data.length, `No elements in array matched ${JSON.stringify(json)}`);
expect(fails < this.response.data.length, `No elements in array matched ${JSON.stringify(json)}`).to.be.true;
} else {
expect(this.response.data).to.deep.match(json);
}
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"acorn": "8.11.3",
"arrify": "2.0.1",
"axios": "1.6.3",
"chai": "4.3.8",
"chai": "5.0.3",
"chai-deep-match": "1.2.1",
"chai-exclude": "2.1.0",
"chai-json-schema": "1.5.1",
Expand All @@ -96,7 +96,6 @@
"glob": "6.0.1",
"html-minifier-terser": "7.2.0",
"inquirer": "6.5.2",
"joi": "17.11.0",
"js-beautify": "1.14.11",
"lodash.clonedeep": "4.5.0",
"lodash.merge": "4.6.2",
Expand Down Expand Up @@ -171,4 +170,4 @@
"npm": ">=5.6.0"
},
"es6": true
}
}
6 changes: 5 additions & 1 deletion test/helper/AppiumV2_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const assert = require('assert');
const { expect } = require('chai');

let expect;
import('chai').then(chai => {
expect = chai.expect;
});
const path = require('path');

const Appium = require('../../lib/helper/Appium');
Expand Down
6 changes: 5 additions & 1 deletion test/helper/Appium_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const assert = require('assert');
const { expect } = require('chai');

let expect;
import('chai').then(chai => {
expect = chai.expect;
});
const path = require('path');

const Appium = require('../../lib/helper/Appium');
Expand Down
7 changes: 6 additions & 1 deletion test/helper/Expect_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const path = require('path');
const { expect } = require('chai');

let expect;
import('chai').then(chai => {
expect = chai.expect;
});

const ExpectHelper = require('../../lib/helper/Expect');

global.codeceptjs = require('../../lib');
Expand Down
5 changes: 4 additions & 1 deletion test/helper/JSONResponse_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const { expect } = require('chai');
let expect;
import('chai').then(chai => {
expect = chai.expect;
});
const joi = require('joi');
const JSONResponse = require('../../lib/helper/JSONResponse');
const Container = require('../../lib/container');
Expand Down
6 changes: 5 additions & 1 deletion test/helper/MockServer_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const path = require('path');
const { expect } = require('chai');

let expect;
import('chai').then(chai => {
expect = chai.expect;
});
const { like } = require('pactum-matchers');
const MockServer = require('../../lib/helper/MockServer');
const REST = require('../../lib/helper/REST');
Expand Down
9 changes: 7 additions & 2 deletions test/helper/Playwright_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const { assert } = require('chai');
const expect = require('chai').expect;
let assert;
let expect;
import('chai').then(chai => {
assert = chai.assert;
expect = chai.expect;
});

const path = require('path');
const fs = require('fs');

Expand Down
28 changes: 16 additions & 12 deletions test/helper/Puppeteer_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const { assert } = require('chai');
const expect = require('chai').expect;
let expect;
let assert;
import('chai').then(chai => {
expect = chai.expect;
assert = chai.assert;
});
const path = require('path');

const puppeteer = require('puppeteer');
Expand Down Expand Up @@ -230,27 +234,27 @@ describe('Puppeteer', function () {
it('should only have 1 tab open when the browser starts and navigates to the first page', () => I.amOnPage('/')
.then(() => I.wait(1))
.then(() => I.grabNumberOfOpenTabs())
.then(numPages => assert.equal(numPages, 1)));
.then(numPages => expect(numPages).to.eq(1)));

it('should switch to next tab', () => I.amOnPage('/info')
.then(() => I.wait(1))
.then(() => I.grabNumberOfOpenTabs())
.then(numPages => assert.equal(numPages, 1))
.then(numPages => expect(numPages).to.eq(1))
.then(() => I.click('New tab'))
.then(() => I.switchToNextTab())
.then(() => I.waitForNumberOfTabs(2))
.then(() => I.seeCurrentUrlEquals('/login'))
.then(() => I.grabNumberOfOpenTabs())
.then(numPages => assert.equal(numPages, 2)));
.then(numPages => expect(numPages).to.eq(2)));

it('should assert when there is no ability to switch to next tab', () => I.amOnPage('/')
.then(() => I.click('More info'))
.then(() => I.wait(1)) // Wait is required because the url is change by previous statement (maybe related to #914)
.then(() => I.switchToNextTab(2))
.then(() => I.wait(2))
.then(() => assert.equal(true, false, 'Throw an error if it gets this far (which it should not)!'))
.then(() => expect(true, 'Throw an error if it gets this far (which it should not)!').to.eq(false))
.catch((e) => {
assert.equal(e.message, 'There is no ability to switch to next tab with offset 2');
expect(e.message).to.eq('There is no ability to switch to next tab with offset 2');
}));

it('should close current tab', () => I.amOnPage('/info')
Expand All @@ -259,12 +263,12 @@ describe('Puppeteer', function () {
.then(() => I.wait(2))
.then(() => I.seeInCurrentUrl('/login'))
.then(() => I.grabNumberOfOpenTabs())
.then(numPages => assert.equal(numPages, 2))
.then(numPages => expect(numPages).to.eq(2))
.then(() => I.closeCurrentTab())
.then(() => I.wait(1))
.then(() => I.seeInCurrentUrl('/info'))
.then(() => I.grabNumberOfOpenTabs())
.then(numPages => assert.equal(numPages, 1)));
.then(numPages => expect(numPages).to.eq(1)));

it('should close other tabs', () => I.amOnPage('/')
.then(() => I.openNewTab())
Expand All @@ -279,14 +283,14 @@ describe('Puppeteer', function () {
.then(() => I.wait(1))
.then(() => I.seeInCurrentUrl('/login'))
.then(() => I.grabNumberOfOpenTabs())
.then(numPages => assert.equal(numPages, 1)));
.then(numPages => expect(numPages).to.eq(1)));

it('should open new tab', () => I.amOnPage('/info')
.then(() => I.openNewTab())
.then(() => I.wait(1))
.then(() => I.seeInCurrentUrl('about:blank'))
.then(() => I.grabNumberOfOpenTabs())
.then(numPages => assert.equal(numPages, 2)));
.then(numPages => expect(numPages).to.eq(2)));

it('should switch to previous tab', () => I.amOnPage('/info')
.then(() => I.openNewTab())
Expand All @@ -304,7 +308,7 @@ describe('Puppeteer', function () {
.then(() => I.wait(2))
.then(() => I.waitInUrl('/info'))
.catch((e) => {
assert.equal(e.message, 'There is no ability to switch to previous tab with offset 2');
expect(e.message).to.eq('There is no ability to switch to previous tab with offset 2');
}));
});

Expand Down
6 changes: 5 additions & 1 deletion test/helper/WebDriver.noSeleniumServer_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const assert = require('assert');
const expect = require('chai').expect;

let expect;
import('chai').then(chai => {
expect = chai.expect;
});
const path = require('path');
const fs = require('fs');

Expand Down
Loading

0 comments on commit 6827822

Please sign in to comment.