-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/vite_5_support
- Loading branch information
Showing
22 changed files
with
465 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"chrome:beta": "125.0.6422.41", | ||
"chrome:stable": "124.0.6367.207", | ||
"chrome:beta": "126.0.6478.7", | ||
"chrome:stable": "125.0.6422.60", | ||
"chrome:minimum": "64.0.3282.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 192 additions & 0 deletions
192
packages/driver/cypress/e2e/util/what-is-circular.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
import { whatIsCircular } from '../../../src/util/what-is-circular' | ||
|
||
describe('what-is-circular', function () { | ||
it('should return undefined if passed a non-object', function () { | ||
expect(whatIsCircular(2)).to.eq(undefined) | ||
}) | ||
|
||
it('should return path for circular objects', function () { | ||
const x: any = {} | ||
|
||
x.cyclic = { a: 1, x } | ||
expect(whatIsCircular(x)).to.deep.eq(['cyclic', 'x']) | ||
}) | ||
|
||
it('should return path for circular objects', function () { | ||
const x: any = {} | ||
|
||
x.cyclic = { a: {}, x } | ||
expect(whatIsCircular(x)).to.deep.eq(['cyclic', 'x']) | ||
}) | ||
|
||
it('should return path for circular objects', function () { | ||
const x: any = {} | ||
|
||
x.cyclic = { a: {}, indirect: { x } } | ||
expect(whatIsCircular(x)).to.deep.eq(['cyclic', 'indirect', 'x']) | ||
}) | ||
|
||
it('should return path for circular objects', function () { | ||
const a = { | ||
a: false, | ||
b: { | ||
a: false, | ||
c: { | ||
a: false, | ||
d: { | ||
e: { | ||
a: false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
a.b.c.d.e = a | ||
|
||
expect(whatIsCircular(a)).to.deep.eq(['b', 'c', 'd', 'e']) | ||
}) | ||
|
||
it('should return path for circular objects', function () { | ||
const x: any = { | ||
a: [ | ||
{ | ||
a: 'b', | ||
b: 'c', | ||
}, | ||
{ | ||
a: 'b', | ||
b: 'c', | ||
}, | ||
], | ||
b: [ | ||
'a', | ||
'b', | ||
], | ||
} | ||
|
||
x.c = { | ||
x, | ||
} | ||
|
||
expect(whatIsCircular(x)).to.deep.eq(['c', 'x']) | ||
}) | ||
|
||
it('should return path for circular objects in arrays', function () { | ||
const x: any = { | ||
a: [ | ||
{ | ||
a: 'b', | ||
b: 'c', | ||
}, | ||
{ | ||
a: 'b', | ||
b: 'c', | ||
}, | ||
], | ||
b: [ | ||
'a', | ||
'b', | ||
], | ||
} | ||
|
||
x.a[2] = x | ||
|
||
expect(whatIsCircular(x)).to.deep.eq(['a', '2']) | ||
}) | ||
|
||
it('should return undefined for non-circular objects', function () { | ||
const x: any = {} | ||
|
||
x.cyclic = { a: 1, b: 2 } | ||
expect(whatIsCircular(x)).to.eq(undefined) | ||
}) | ||
|
||
it('should return undefined for non-circular objects', function () { | ||
const x: any = { | ||
a: [ | ||
{ | ||
a: 'b', | ||
b: 'c', | ||
}, | ||
{ | ||
a: 'b', | ||
b: 'c', | ||
}, | ||
], | ||
b: [ | ||
'a', | ||
'b', | ||
], | ||
} | ||
|
||
expect(whatIsCircular(x)).to.eq(undefined) | ||
}) | ||
|
||
it('should return undefined for non-circular objects', function () { | ||
const x: any = {} | ||
const y = {} | ||
|
||
x.cyclic = { a: y, b: y } | ||
expect(whatIsCircular(x)).to.eq(undefined) | ||
}) | ||
|
||
it('detects circular objects and returns path', function () { | ||
const obj1: any = {} | ||
|
||
obj1.x = obj1 | ||
expect(whatIsCircular(obj1)).to.deep.eq(['x']) | ||
|
||
const obj2: any = {} | ||
|
||
obj2.x = { y: obj2 } | ||
expect(whatIsCircular(obj2)).to.deep.eq(['x', 'y']) | ||
}) | ||
|
||
it('detects circular arrays and returns path', function () { | ||
const obj1: any = [] | ||
|
||
obj1.push(obj1) | ||
expect(whatIsCircular(obj1)).to.deep.eq(['0']) | ||
}) | ||
|
||
it('detects non-circular objects and returns undefined', function () { | ||
const obj1: any = {} | ||
|
||
obj1.x = { y: 4 } | ||
expect(whatIsCircular(obj1)).to.be.undefined | ||
|
||
expect(whatIsCircular({})).to.be.undefined | ||
}) | ||
|
||
it('detects non-circular arrays and returns undefined', function () { | ||
const obj1: any[] = [] | ||
|
||
obj1.push([]) | ||
expect(whatIsCircular(obj1)).to.be.undefined | ||
}) | ||
|
||
it('returns undefined for non-objects', function () { | ||
expect(whatIsCircular(undefined)).to.be.undefined | ||
expect(whatIsCircular(null)).to.be.undefined | ||
expect(whatIsCircular('hi')).to.be.undefined | ||
expect(whatIsCircular(false)).to.be.undefined | ||
expect(whatIsCircular(/a/)).to.be.undefined | ||
}) | ||
|
||
it('returns undefined for non-circular functions', function () { | ||
expect(whatIsCircular(function () {})).to.be.undefined | ||
}) | ||
|
||
it('returns path for circular functions', function () { | ||
const f: any = function () {} | ||
|
||
f.x = { | ||
y: { | ||
f, | ||
}, | ||
} | ||
|
||
expect(whatIsCircular(f)).to.deep.eq(['x', 'y', 'f']) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const lodash = require('lodash') | ||
|
||
export function whatIsCircular (obj) { | ||
if (!lodash.isObject(obj)) { | ||
return | ||
} | ||
|
||
return _dfs(obj) | ||
} | ||
|
||
function _dfs (obj, parents: any[] = [], parentKeys: any[] = []) { | ||
// recurse depth-first until we hit something we've seen before | ||
for (const key in obj) { | ||
const val = obj[key] | ||
|
||
if (lodash.isObject(val)) { | ||
if (lodash.includes(parents, val)) { | ||
return parentKeys | ||
} | ||
|
||
const path = _dfs(val, parents.concat([val]), parentKeys.concat([key])) | ||
|
||
if (path) return path | ||
} | ||
} | ||
} |
Oops, something went wrong.
c6941da
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version
Run this command to install the pre-release locally:
c6941da
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux arm64
version of the Test Runner.Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version
Run this command to install the pre-release locally:
c6941da
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
win32 x64
version of the Test Runner.Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version
Run this command to install the pre-release locally:
c6941da
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin arm64
version of the Test Runner.Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version
Run this command to install the pre-release locally:
c6941da
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin x64
version of the Test Runner.Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version
Run this command to install the pre-release locally: