Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Revert "Suite clone does not clone fullUrl fixed"
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy-kiselyov committed Mar 16, 2018
1 parent 3e12e72 commit 3c40424
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
1 change: 0 additions & 1 deletion lib/runner/browser-runner/index.js
Expand Up @@ -30,7 +30,6 @@ module.exports = class BrowserRunner extends Runner {
.map((suite) => {
if (suite.hasOwnProperty('url')) {
Object.defineProperty(suite, 'fullUrl', {
enumerable: true,
get: () => this._mkFullUrl(suite.url)
});
}
Expand Down
3 changes: 1 addition & 2 deletions lib/suite.js
Expand Up @@ -84,8 +84,7 @@ module.exports = class Suite {
const clonedSuite = Suite.create(this.name, this.parent);

_.forOwn(this, (value, key) => {
let desc = Object.getOwnPropertyDescriptor(this, key);
Object.defineProperty(clonedSuite, key, _.cloneDeep(desc));
clonedSuite[key] = _.clone(value);
});

this.children.forEach((child) => clonedSuite.addChild(child.clone()));
Expand Down
19 changes: 1 addition & 18 deletions test/unit/suite.js
Expand Up @@ -342,26 +342,9 @@ describe('suite', () => {

it('should return cloned suite', () => {
const suite = createSuite('origin');
suite.browsers = ['bro1', 'bro2'];
const clonedSuite = suite.clone();

assert.deepEqual(clonedSuite, suite);
assert.notEqual(clonedSuite, suite); //not equal by link
assert.notEqual(clonedSuite.browsers, suite.browsers); //not equal by link
});

it('should clone all enumerable properties', () => {
const suite = createSuite('origin');
let value = 'some/path';
Object.defineProperty(suite, 'fullUrl', {
enumerable: true,
get: () => value
});
const clonedSuite = suite.clone();

assert.equal(clonedSuite.fullUrl, 'some/path');
value = 'another/path';
assert.equal(clonedSuite.fullUrl, 'another/path');
assert.notEqual(clonedSuite, suite);
});

it('should clone nested suites', () => {
Expand Down

0 comments on commit 3c40424

Please sign in to comment.