Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions grunt/sauce.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var each = require('../src/utils').each
Copy link
Contributor

Choose a reason for hiding this comment

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

since this is part of the tooling you can just use lodash here.

var sauceConfig = {
username: 'nuclearjs',
accessKey: process.env.SAUCE_ACCESS_KEY,
Expand Down Expand Up @@ -70,14 +71,14 @@ var batches = {
},
}

for (var key in batches) {
each(batches, function(value, key) {
exports[key] = {
sauceLabs: sauceConfig,
// mobile emulators are really slow
captureTimeout: 300000,
browserNoActivityTimeout: 300000,
customLaunchers: batches[key],
browsers: Object.keys(batches[key]),
customLaunchers: value,
browsers: Object.keys(value),
reporters: ['progress', 'saucelabs'],
}
}
})
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ exports.each = function(collection, iteratee, context) {

if (context) {
origIteratee = iteratee
iteratee = function(value, index, collection) {
return origIteratee.call(context, value, index, collection)
iteratee = function(value, index, innerCollection) {
return origIteratee.call(context, value, index, innerCollection)
}
}

Expand Down
12 changes: 6 additions & 6 deletions tests/evaluator-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ describe('Evaluator', () => {
currentProjectGetter = [
['projects'],
['session', 'currentProjectId'],
(projects, currentProjectId) => {
(allProjects, currentProjectId) => {
currentProjectSpy()
return projects.get(currentProjectId)
return allProjects.get(currentProjectId)
},
]
currentProjectDescriptionGetter = [
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('Evaluator', () => {
it('should prevent nested evaluate calls', () => {
var nestedEvaluateGetter = [
currentProjectGetter,
(projects) => {
() => {
return evaluator.evaluate(state, currentProjectDescriptionGetter)
},
]
Expand Down Expand Up @@ -168,8 +168,8 @@ describe('Evaluator', () => {
var currentProjectGetter = [
['projects'],
['session', 'currentProjectId'],
(projects, currentProjectId) => {
return projects.get(currentProjectId)
(allProjects, currentProjectId) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Im not really a fan of this rule, we dont write a lot of large JS files with nested closures and sometimes using the same variable name is more correct than a "new" one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can change rules and fix the respective lint issues in future PRs as we change our minds about styling rules. 👍

return allProjects.get(currentProjectId)
},
]

Expand All @@ -179,7 +179,7 @@ describe('Evaluator', () => {
var result2 = evaluator.evaluate(state, currentProjectGetter)
expect(result2).toBe(proj1)
// update state test the `hasStaleValue` codepath
var state1 = state.update('projects', projects => projects.set(3, proj3))
var state1 = state.update('projects', allProjects => allProjects.set(3, proj3))

var result3 = evaluator.evaluate(state1, currentProjectGetter)
expect(result3).toBe(proj1)
Expand Down
6 changes: 3 additions & 3 deletions tests/store-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ describe('Store', () => {

initialize: function() {
this.on('addExperiments', (state, payload) => {
return state.withMutations(state => {
return state.withMutations(innerState => {
payload.data.forEach(item => {
state.setIn(['experiments', item.id], Map(item))
innerState.setIn(['experiments', item.id], Map(item))
})
return state
return innerState
})
})

Expand Down
2 changes: 2 additions & 0 deletions tests/utils-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ describe('Utils', () => {
})

it('identifies instances as Object types', () => {
/* eslint-disable no-new-wrappers */
expect(Utils.isObject(new Number(0))).toBe(true)
expect(Utils.isObject(new String(''))).toBe(true)
expect(Utils.isObject(new Boolean(''))).toBe(true)
/* eslint-enable no-new-wrappers */
})
})

Expand Down