Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

update moment module from testcafe/node_modules/ (closes #1750) #2452

Merged
merged 10 commits into from
May 30, 2018

Conversation

AlexKamaev
Copy link
Contributor

No description provided.

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit ced2d10 have failed. See details:

@AlexKamaev
Copy link
Contributor Author

@testcafe-build-bot \retest

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit ced2d10 have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit ced2d10 have failed. See details:

2 similar comments
@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit ced2d10 have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit ced2d10 have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit ced2d10 have passed. See details:

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit f210c6f have passed. See details:

@AlexKamaev AlexKamaev requested a review from AndreyBelym May 25, 2018 08:58
}

if (testcafeMomentModulePath !== sideMomentModulePath) {
require(sideMomentModulePath);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, you shouldn't require the side module at all.


require(momentDurationFormatPath);

if (testcafeMomentModuleCached)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must check for sideMomentModuleCached here.

@@ -1,8 +1,7 @@
import chalk from 'chalk';
import indentString from 'indent-string';
import { identity, escape as escapeHtml, assignIn } from 'lodash';
import moment from 'moment';
import 'moment-duration-format';
import moment from './moment-duration-format-loader';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's name the loader module moment-loader.js, and move it to src/utils.

@@ -0,0 +1,33 @@
const resolveFrom = require('resolve-from');
const testcafeMomentModulePath = require.resolve('moment');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, we also must be carefull with TestCafe-related module. Let's handle it with the following algorithm:

const originalModule = cache[modulePath];

delete cache[modulePath];

const module = require(modulePath);
// ...
// do stuff
// ...

if (originalModule)
    cache[modulePath] = originalModule;
else
    delete cache[originalModule];

require(sideMomentModulePath);

const testcafeMomentModuleCached = require.cache[testcafeMomentModulePath];
const siteMomentModuleCached = require.cache[sideMomentModulePath];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const sideMomentModuleCached

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit d7a1972 have failed. See details:

@AndreyBelym
Copy link
Contributor

@testcafe-build-bot retest

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit d7a1972 have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit 4155a9b have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit 8c8544c have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit 2e51e75 have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit 2e51e75 have passed. See details:

@AndreyBelym
Copy link
Contributor

\сс @helen-dikareva

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit a3bd588 have failed. See details:

}

function getModulesPaths () {
const durationFormatModulePath = require.resolve('moment-duration-format');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should move modules names into consts?

const modulesPaths = getModulesPaths();
const momentModules = getMomentModules(modulesPaths);

if (modulesPaths.sideMomentModulePath && modulesPaths.sideMomentModulePath !== modulesPaths.mainMomentModulePath) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can assign const { sideMomentModulePath, mainMomentModulePath, durationFormatModulePath } = modulesPaths; to make code more readable

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit fe7ef86 have failed. See details:

@AndreyBelym
Copy link
Contributor

@testcafe-build-bot retest

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit fe7ef86 have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit b4b5035 have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit 4415d73 have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit 2645006 have passed. See details:

@AndreyBelym AndreyBelym merged commit ec1f3f2 into DevExpress:master May 30, 2018
kirovboris pushed a commit to kirovboris/testcafe-phoenix that referenced this pull request Dec 18, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants