Skip to content

Commit 6827822

Browse files
chore(deps): bump chai from 4.3.8 to 5.0.3 (#4174)
* 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]>
1 parent 25806cb commit 6827822

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+276
-125
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Go over the steps in [this](https://github.com/firstcontributions/first-contribu
77
To start you need:
88

99
1. Fork and clone the repo.
10-
2. Run `npm install --legacy-peer-deps --omit=optional` to install all required libraries
10+
2. Run `npm i --force --omit=optional` to install all required libraries
1111
3. Do the changes.
1212
4. Add/Update Test (if possible)
1313
5. Update documentation

.github/workflows/appiumV2_Android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/setup-node@v4
2626
with:
2727
node-version: ${{ matrix.node-version }}
28-
- run: npm install --legacy-peer-deps
28+
- run: npm i --force
2929
env:
3030
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
3131
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true

.github/workflows/appiumV2_iOS.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/setup-node@v4
2626
with:
2727
node-version: ${{ matrix.node-version }}
28-
- run: npm install --legacy-peer-deps
28+
- run: npm i --force
2929
env:
3030
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
3131
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true

.github/workflows/doc-generation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
node-version: ${{ matrix.node-version }}
2424

2525
- name: Install Dependencies
26-
run: npm install --legacy-peer-deps
26+
run: npm i --force
2727

2828
- name: Configure git user
2929
run: |

.github/workflows/dtslint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version: ${{ matrix.node-version }}
23-
- run: npm install --legacy-peer-deps
23+
- run: npm i --force
2424
env:
2525
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
2626
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true

.github/workflows/expectHelper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ jobs:
2929
with:
3030
node-version: ${{ matrix.node-version }}
3131
- name: npm install
32-
run: npm i --legacy-peer-deps
32+
run: npm i --force
3333
- name: run unit tests
3434
run: ./node_modules/.bin/mocha test/helper/Expect_test.js --timeout 5000

.github/workflows/mockServerHelper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ jobs:
2929
with:
3030
node-version: ${{ matrix.node-version }}
3131
- name: npm install
32-
run: npm i --legacy-peer-deps
32+
run: npm i --force
3333
- name: run unit tests
3434
run: npm run test:unit:mockServer

.github/workflows/playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
php-version: 7.4
3434
- name: npm install
3535
run: |
36-
npm install --legacy-peer-deps
36+
npm i --force
3737
env:
3838
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
3939
- name: Install browsers and deps

.github/workflows/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
php-version: 7.4
3434
- name: npm install
3535
run: |
36-
npm install --legacy-peer-deps
36+
npm i --force
3737
env:
3838
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
3939
- name: Install browsers and deps

.github/workflows/puppeteer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
php-version: 7.4
3434
- name: npm install
3535
run: |
36-
npm install --legacy-peer-deps && npm i puppeteer --legacy-peer-deps
36+
npm i --force && npm i puppeteer --force
3737
env:
3838
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
3939
- name: start a server

.github/workflows/testcafe.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
php-version: 7.4
3535
- name: npm install
3636
run: |
37-
npm install --legacy-peer-deps
37+
npm i --force
3838
env:
3939
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
4040
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true

.github/workflows/webdriver.devtools.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
php-version: 8.0
3333
- name: npm install
3434
run: |
35-
npm install --legacy-peer-deps
35+
npm i --force
3636
env:
3737
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
3838
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true

.github/workflows/webdriver.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
php-version: 8.0
3434
- name: npm install
3535
run: |
36-
npm install --legacy-peer-deps
36+
npm i --force
3737
env:
3838
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
3939
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
2929
COPY . /codecept
3030

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

3434
RUN ln -s /codecept/bin/codecept.js /usr/local/bin/codeceptjs
3535
RUN mkdir /tests

docs/pageobjects.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Scenario('sample test', ({ I, myPage, mySteps }) => {
3737

3838
## Actor
3939

40-
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`:
40+
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`:
4141

4242
```js
4343
module.exports = function() {
@@ -153,7 +153,7 @@ Scenario('login2', async ({ I, loginPage, basePage }) => {
153153
});
154154
```
155155

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

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

lib/helper/Expect.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
const chai = require('chai');
21
const output = require('../output');
32

4-
const { expect } = chai;
3+
let expect;
54

6-
chai.use(require('chai-string'));
7-
// @ts-ignore
8-
chai.use(require('chai-exclude'));
9-
chai.use(require('chai-match-pattern'));
5+
import('chai').then(chai => {
6+
expect = chai.expect;
7+
chai.use(require('chai-string'));
8+
// @ts-ignore
9+
chai.use(require('chai-exclude'));
10+
chai.use(require('chai-match-pattern'));
11+
chai.use(require('chai-json-schema'));
12+
});
1013

1114
/**
1215
* This helper allows performing assertions based on Chai.
@@ -179,7 +182,7 @@ class ExpectHelper {
179182
expectJsonSchema(targetData, jsonSchema, customErrorMsg = '') {
180183
// @ts-ignore
181184
output.step(`I expect "${JSON.stringify(targetData)}" to match this JSON schema "${JSON.stringify(jsonSchema)}"`);
182-
chai.use(require('chai-json-schema'));
185+
183186
return expect(targetData, customErrorMsg).to.be.jsonSchema(jsonSchema);
184187
}
185188

lib/helper/JSONResponse.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
const assert = require('assert');
2-
const chai = require('chai');
3-
const joi = require('joi');
4-
const chaiDeepMatch = require('chai-deep-match');
51
const Helper = require('@codeceptjs/helper');
62

7-
chai.use(chaiDeepMatch);
3+
let expect;
4+
5+
import('chai').then(chai => {
6+
expect = chai.expect;
7+
chai.use(require('chai-deep-match'));
8+
});
89

9-
const { expect } = chai;
10+
const joi = require('joi');
1011

1112
/**
1213
* This helper allows performing assertions on JSON responses paired with following helpers:
@@ -91,7 +92,6 @@ class JSONResponse extends Helper {
9192
static _checkRequirements() {
9293
try {
9394
require('joi');
94-
require('chai');
9595
} catch (e) {
9696
return ['joi'];
9797
}
@@ -194,7 +194,7 @@ class JSONResponse extends Helper {
194194
fails++;
195195
}
196196
}
197-
assert.ok(fails < this.response.data.length, `No elements in array matched ${JSON.stringify(json)}`);
197+
expect(fails < this.response.data.length, `No elements in array matched ${JSON.stringify(json)}`).to.be.true;
198198
} else {
199199
expect(this.response.data).to.deep.match(json);
200200
}

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"acorn": "8.11.3",
7676
"arrify": "2.0.1",
7777
"axios": "1.6.3",
78-
"chai": "4.3.8",
78+
"chai": "5.0.3",
7979
"chai-deep-match": "1.2.1",
8080
"chai-exclude": "2.1.0",
8181
"chai-json-schema": "1.5.1",
@@ -96,7 +96,6 @@
9696
"glob": "6.0.1",
9797
"html-minifier-terser": "7.2.0",
9898
"inquirer": "6.5.2",
99-
"joi": "17.11.0",
10099
"js-beautify": "1.14.11",
101100
"lodash.clonedeep": "4.5.0",
102101
"lodash.merge": "4.6.2",
@@ -171,4 +170,4 @@
171170
"npm": ">=5.6.0"
172171
},
173172
"es6": true
174-
}
173+
}

test/helper/AppiumV2_test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
const assert = require('assert');
2-
const { expect } = require('chai');
2+
3+
let expect;
4+
import('chai').then(chai => {
5+
expect = chai.expect;
6+
});
37
const path = require('path');
48

59
const Appium = require('../../lib/helper/Appium');

test/helper/Appium_test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
const assert = require('assert');
2-
const { expect } = require('chai');
2+
3+
let expect;
4+
import('chai').then(chai => {
5+
expect = chai.expect;
6+
});
37
const path = require('path');
48

59
const Appium = require('../../lib/helper/Appium');

test/helper/Expect_test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
const path = require('path');
2-
const { expect } = require('chai');
2+
3+
let expect;
4+
import('chai').then(chai => {
5+
expect = chai.expect;
6+
});
7+
38
const ExpectHelper = require('../../lib/helper/Expect');
49

510
global.codeceptjs = require('../../lib');

test/helper/JSONResponse_test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
const { expect } = require('chai');
1+
let expect;
2+
import('chai').then(chai => {
3+
expect = chai.expect;
4+
});
25
const joi = require('joi');
36
const JSONResponse = require('../../lib/helper/JSONResponse');
47
const Container = require('../../lib/container');

test/helper/MockServer_test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
const path = require('path');
2-
const { expect } = require('chai');
2+
3+
let expect;
4+
import('chai').then(chai => {
5+
expect = chai.expect;
6+
});
37
const { like } = require('pactum-matchers');
48
const MockServer = require('../../lib/helper/MockServer');
59
const REST = require('../../lib/helper/REST');

test/helper/Playwright_test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
const { assert } = require('chai');
2-
const expect = require('chai').expect;
1+
let assert;
2+
let expect;
3+
import('chai').then(chai => {
4+
assert = chai.assert;
5+
expect = chai.expect;
6+
});
7+
38
const path = require('path');
49
const fs = require('fs');
510

test/helper/Puppeteer_test.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
const { assert } = require('chai');
2-
const expect = require('chai').expect;
1+
let expect;
2+
let assert;
3+
import('chai').then(chai => {
4+
expect = chai.expect;
5+
assert = chai.assert;
6+
});
37
const path = require('path');
48

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

235239
it('should switch to next tab', () => I.amOnPage('/info')
236240
.then(() => I.wait(1))
237241
.then(() => I.grabNumberOfOpenTabs())
238-
.then(numPages => assert.equal(numPages, 1))
242+
.then(numPages => expect(numPages).to.eq(1))
239243
.then(() => I.click('New tab'))
240244
.then(() => I.switchToNextTab())
241245
.then(() => I.waitForNumberOfTabs(2))
242246
.then(() => I.seeCurrentUrlEquals('/login'))
243247
.then(() => I.grabNumberOfOpenTabs())
244-
.then(numPages => assert.equal(numPages, 2)));
248+
.then(numPages => expect(numPages).to.eq(2)));
245249

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

256260
it('should close current tab', () => I.amOnPage('/info')
@@ -259,12 +263,12 @@ describe('Puppeteer', function () {
259263
.then(() => I.wait(2))
260264
.then(() => I.seeInCurrentUrl('/login'))
261265
.then(() => I.grabNumberOfOpenTabs())
262-
.then(numPages => assert.equal(numPages, 2))
266+
.then(numPages => expect(numPages).to.eq(2))
263267
.then(() => I.closeCurrentTab())
264268
.then(() => I.wait(1))
265269
.then(() => I.seeInCurrentUrl('/info'))
266270
.then(() => I.grabNumberOfOpenTabs())
267-
.then(numPages => assert.equal(numPages, 1)));
271+
.then(numPages => expect(numPages).to.eq(1)));
268272

269273
it('should close other tabs', () => I.amOnPage('/')
270274
.then(() => I.openNewTab())
@@ -279,14 +283,14 @@ describe('Puppeteer', function () {
279283
.then(() => I.wait(1))
280284
.then(() => I.seeInCurrentUrl('/login'))
281285
.then(() => I.grabNumberOfOpenTabs())
282-
.then(numPages => assert.equal(numPages, 1)));
286+
.then(numPages => expect(numPages).to.eq(1)));
283287

284288
it('should open new tab', () => I.amOnPage('/info')
285289
.then(() => I.openNewTab())
286290
.then(() => I.wait(1))
287291
.then(() => I.seeInCurrentUrl('about:blank'))
288292
.then(() => I.grabNumberOfOpenTabs())
289-
.then(numPages => assert.equal(numPages, 2)));
293+
.then(numPages => expect(numPages).to.eq(2)));
290294

291295
it('should switch to previous tab', () => I.amOnPage('/info')
292296
.then(() => I.openNewTab())
@@ -304,7 +308,7 @@ describe('Puppeteer', function () {
304308
.then(() => I.wait(2))
305309
.then(() => I.waitInUrl('/info'))
306310
.catch((e) => {
307-
assert.equal(e.message, 'There is no ability to switch to previous tab with offset 2');
311+
expect(e.message).to.eq('There is no ability to switch to previous tab with offset 2');
308312
}));
309313
});
310314

test/helper/WebDriver.noSeleniumServer_test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
const assert = require('assert');
2-
const expect = require('chai').expect;
2+
3+
let expect;
4+
import('chai').then(chai => {
5+
expect = chai.expect;
6+
});
37
const path = require('path');
48
const fs = require('fs');
59

0 commit comments

Comments
 (0)