chore(deps): update jest monorepo (major) (#791)

* chore(deps): update jest monorepo

* Changes for jest 27

* Update types as well

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Nathan Bierema <nbierema@gmail.com>
This commit is contained in:
renovate[bot] 2021-08-27 16:08:40 +00:00 committed by GitHub
parent 0101471ffb
commit 5cee92d1ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 726 additions and 582 deletions

View File

@ -1,4 +1,5 @@
module.exports = {
setupFilesAfterEnv: ['<rootDir>/test/setup.js'],
testPathIgnorePatterns: ['<rootDir>/examples'],
testEnvironment: 'jsdom',
};

View File

@ -10,10 +10,12 @@ const actionsPattern =
/^@@INIT(.|\n)+@@reduxReactRouter\/routerDidChange(.|\n)+@@reduxReactRouter\/initRoutes(.|\n)+$/;
describe('Chrome extension', function () {
let driver;
beforeAll(async () => {
chromedriver.start();
await delay(2000);
this.driver = new webdriver.Builder()
driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`)
.withCapabilities({
chromeOptions: {
@ -23,31 +25,32 @@ describe('Chrome extension', function () {
.forBrowser('chrome')
.build();
});
afterAll(async () => {
await this.driver.quit();
await driver.quit();
chromedriver.stop();
});
it("should open extension's window", async () => {
await this.driver.get(`chrome-extension://${extensionId}/window.html#left`);
const url = await this.driver.getCurrentUrl();
await driver.get(`chrome-extension://${extensionId}/window.html#left`);
const url = await driver.getCurrentUrl();
expect(url).toBe(`chrome-extension://${extensionId}/window.html#left`);
});
it('should match document title', async () => {
const title = await this.driver.getTitle();
const title = await driver.getTitle();
expect(title).toBe('Redux DevTools');
});
it("should contain inspector monitor's component", async () => {
const val = await this.driver
const val = await driver
.findElement(webdriver.By.xpath('//div[contains(@class, "inspector-")]'))
.getText();
expect(val).toBeDefined();
});
it('should contain an empty actions list', async () => {
const val = await this.driver
const val = await driver
.findElement(
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]')
)
@ -56,24 +59,24 @@ describe('Chrome extension', function () {
});
Object.keys(switchMonitorTests).forEach((description) =>
it(description, switchMonitorTests[description].bind(this))
it(description, () => switchMonitorTests[description](driver))
);
it('should get actions list', async () => {
const url = 'http://zalmoxisus.github.io/examples/router/';
await this.driver.executeScript(`window.open('${url}')`);
await driver.executeScript(`window.open('${url}')`);
await delay(2000);
const tabs = await this.driver.getAllWindowHandles();
const tabs = await driver.getAllWindowHandles();
await this.driver.switchTo().window(tabs[1]);
expect(await this.driver.getCurrentUrl()).toMatch(url);
await this.driver.manage().timeouts().pageLoadTimeout(5000);
await driver.switchTo().window(tabs[1]);
expect(await driver.getCurrentUrl()).toMatch(url);
await driver.manage().timeouts().pageLoadTimeout(5000);
await this.driver.switchTo().window(tabs[0]);
await driver.switchTo().window(tabs[0]);
const result = await this.driver.wait(
this.driver
const result = await driver.wait(
driver
.findElement(
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]')
)

View File

@ -9,10 +9,12 @@ const devPanelPath =
'chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/window.html';
describe('DevTools panel for Electron', function () {
let driver;
beforeAll(async () => {
chromedriver.start();
await delay(1000);
this.driver = new webdriver.Builder()
driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`)
.withCapabilities({
chromeOptions: {
@ -22,33 +24,33 @@ describe('DevTools panel for Electron', function () {
})
.forBrowser('electron')
.build();
await this.driver.manage().timeouts().setScriptTimeout(10000);
await driver.manage().timeouts().setScriptTimeout(10000);
});
afterAll(async () => {
await this.driver.quit();
await driver.quit();
chromedriver.stop();
});
it('should open Redux DevTools tab', async () => {
if (!(await this.driver.getCurrentUrl()).startsWith('devtools')) {
const originalWindow = await this.driver.getWindowHandle();
const windows = await this.driver.getAllWindowHandles();
if (!(await driver.getCurrentUrl()).startsWith('devtools')) {
const originalWindow = await driver.getWindowHandle();
const windows = await driver.getAllWindowHandles();
for (const window of windows) {
if (window === originalWindow) continue;
await this.driver.switchTo().window(window);
if ((await this.driver.getCurrentUrl()).startsWith('devtools')) {
await driver.switchTo().window(window);
if ((await driver.getCurrentUrl()).startsWith('devtools')) {
break;
}
}
}
expect(await this.driver.getCurrentUrl()).toMatch(
expect(await driver.getCurrentUrl()).toMatch(
/devtools:\/\/devtools\/bundled\/devtools_app.html/
);
await this.driver.manage().timeouts().pageLoadTimeout(5000);
await driver.manage().timeouts().pageLoadTimeout(5000);
const id = await this.driver.executeAsyncScript(function (callback) {
const id = await driver.executeAsyncScript(function (callback) {
let attempts = 5;
function showReduxPanel() {
if (attempts === 0) {
@ -71,17 +73,17 @@ describe('DevTools panel for Electron', function () {
});
expect(id).toBe('chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljdRedux');
const className = await this.driver
const className = await driver
.findElement(webdriver.By.className(id))
.getAttribute('class');
expect(className).not.toMatch(/hidden/); // not hidden
});
it('should have Redux DevTools UI on current tab', async () => {
await this.driver
await driver
.switchTo()
.frame(
this.driver.findElement(
driver.findElement(
webdriver.By.xpath(`//iframe[@src='${devPanelPath}']`)
)
);
@ -89,7 +91,7 @@ describe('DevTools panel for Electron', function () {
});
it('should contain INIT action', async () => {
const element = await this.driver.wait(
const element = await driver.wait(
webdriver.until.elementLocated(
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]')
),
@ -101,23 +103,23 @@ describe('DevTools panel for Electron', function () {
});
it("should contain Inspector monitor's component", async () => {
const val = await this.driver
const val = await driver
.findElement(webdriver.By.xpath('//div[contains(@class, "inspector-")]'))
.getText();
expect(val).toBeDefined();
});
Object.keys(switchMonitorTests).forEach((description) =>
it(description, switchMonitorTests[description].bind(this))
it(description, () => switchMonitorTests[description](driver))
);
/* it('should be no logs in console of main window', async () => {
const handles = await this.driver.getAllWindowHandles();
await this.driver.switchTo().window(handles[1]); // Change to main window
const handles = await driver.getAllWindowHandles();
await driver.switchTo().window(handles[1]); // Change to main window
expect(await this.driver.getTitle()).toBe('Electron Test');
expect(await driver.getTitle()).toBe('Electron Test');
const logs = await this.driver.manage().logs().get(webdriver.logging.Type.BROWSER);
const logs = await driver.manage().logs().get(webdriver.logging.Type.BROWSER);
expect(logs).toEqual([]);
});
*/

View File

@ -4,16 +4,16 @@ export const delay = (time) =>
new Promise((resolve) => setTimeout(resolve, time));
export const switchMonitorTests = {
'should switch to Log Monitor': async function () {
await this.driver
'should switch to Log Monitor': async function (driver) {
await driver
.findElement(webdriver.By.xpath('//button[text()="Inspector"]'))
.click();
await delay(500); // Wait till menu is fully opened
await this.driver
await driver
.findElement(webdriver.By.xpath('//button[text()="Log monitor"]'))
.click();
await delay(500);
await this.driver.findElement(
await driver.findElement(
webdriver.By.xpath(
'//div[div[button[text()="Reset"]] and .//div[button[text()="Revert"]]]'
)
@ -21,27 +21,27 @@ export const switchMonitorTests = {
await delay(500);
},
'should switch to Chart Monitor': async function () {
await this.driver
'should switch to Chart Monitor': async function (driver) {
await driver
.findElement(webdriver.By.xpath('//button[text()="Log monitor"]'))
.click();
await delay(500); // Wait till menu is fully opened
await this.driver
await driver
.findElement(webdriver.By.xpath('//button[text()="Chart"]'))
.click();
await delay(500);
await this.driver.findElement(
await driver.findElement(
webdriver.By.xpath('//*[@class="nodeText" and text()="state"]')
);
await delay(500); // Wait till menu is closed
},
'should switch back to Inspector Monitor': async function () {
await this.driver
'should switch back to Inspector Monitor': async function (driver) {
await driver
.findElement(webdriver.By.xpath('//button[text()="Chart"]'))
.click();
await delay(1000); // Wait till menu is fully opened
await this.driver
await driver
.findElement(webdriver.By.xpath('//button[text()="Inspector"]'))
.click();
await delay(1500); // Wait till menu is closed

View File

@ -8,7 +8,7 @@
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.15.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.0.1",
"@types/node": "^14.17.12",
"@types/webpack": "^4.41.30",
"@types/webpack-dev-server": "^3.11.6",
@ -30,7 +30,7 @@
"fork-ts-checker-webpack-plugin": "^6.3.2",
"html-loader": "^1.3.2",
"html-webpack-plugin": "^4.5.2",
"jest": "^26.6.3",
"jest": "^27.1.0",
"lerna": "^4.0.0",
"prettier": "^2.3.2",
"pug-html-loader": "^1.1.5",
@ -42,7 +42,7 @@
"stylelint-config-standard": "^22.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0",
"ts-jest": "^26.5.6",
"ts-jest": "^27.0.5",
"ts-node": "^10.2.1",
"typescript": "^4.3.5",
"url-loader": "^4.1.1",

View File

@ -1,4 +1,5 @@
module.exports = {
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
testEnvironment: 'jsdom',
};

View File

@ -1,3 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
};

View File

@ -1,3 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
};

View File

@ -1,4 +1,5 @@
module.exports = {
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
testEnvironment: 'jsdom',
};

View File

@ -72,7 +72,7 @@
"@types/semver": "^7.3.8",
"@types/supertest": "^2.0.11",
"@types/uuid": "^8.3.1",
"jest": "^26.6.3",
"jest": "^27.1.0",
"ncp": "^2.0.0",
"socketcluster-client": "^14.3.2",
"supertest": "^6.1.6"

View File

@ -1,4 +1,5 @@
module.exports = {
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
testEnvironment: 'jsdom',
};

View File

@ -72,7 +72,7 @@
"enzyme-to-json": "^3.6.2",
"history": "^4.10.1",
"immutable": "^4.0.0-rc.14",
"jest": "^26.6.3",
"jest": "^27.1.0",
"lodash.shuffle": "^4.2.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",

View File

@ -1,3 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
};

View File

@ -44,7 +44,7 @@
},
"devDependencies": {
"@types/lodash": "^4.14.172",
"jest": "^26.6.3",
"jest": "^27.1.0",
"redux": "^4.1.1",
"rxjs": "^7.3.0"
},

1188
yarn.lock

File diff suppressed because it is too large Load Diff