New issue

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

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

Already on GitHub? Sign in to your account

Added caniuse-lite browsers release date check #267

Merged
merged 5 commits into from Jun 13, 2018

Conversation

Projects
None yet
2 participants
@An-Tu
Contributor

An-Tu commented Jun 2, 2018

No description provided.

it('checkCanIUse doesn\'t throw warning', () => {
browserslist('last 2 versions')
expect(console.warn).toHaveBeenCalledTimes(1)

This comment has been minimized.

@ai

ai Jun 2, 2018

Member

It is better to check exact text (maybe Jest will throw warning too)

This comment has been minimized.

@ai

ai Jun 2, 2018

Member

Also, we need to check yarn/npm detection. You can do it by mocking fs methods.

node.js Outdated
var halfYearAgo = new Date(
today.getFullYear(),
today.getMonth() - MONTH_TO_UPDATE_CANIUSE,
today.getDate()

This comment has been minimized.

@ai

ai Jun 2, 2018

Member

It could generate invalid date if today in 31 days of month and month - 6 will have only 28/30 days.

It is better just use Date.now() - 6 * 30 * 24 * 60 * 60 * 1000

node.js Outdated
var hasYarnLock = false
eachParent(__filename, function (dir) {
var yarnLock = path.join(dir, 'yarn.lock')
if (isFile(yarnLock)) {

This comment has been minimized.

@ai

ai Jun 2, 2018

Member

It is better to check package.json and yarn.lock in the same dir

node.js Outdated
})
var packageManager = hasYarnLock ? 'yarn upgrade' : 'npm update'
console.warn('\x1b[1m!!![Browserslist] WARN: ' +

This comment has been minimized.

@ai

ai Jun 2, 2018

Member

Not every terminal has color support

@ai

This comment has been minimized.

Member

ai commented Jun 2, 2018

Thanks, good PR. But you need a few fixes (I added comments).

Node.js checkCanIUse - was amended time constant to update canius, no…
…w we look for package.json too. Update release test. Years test - added now's method to the mocked Date
@An-Tu

This comment has been minimized.

Contributor

An-Tu commented Jun 2, 2018

Hi. I corrected and I wait for comments =)

@ai

This comment has been minimized.

Member

ai commented Jun 2, 2018

  1. You need to fix Travis CI (reduce the size or increase limit).
  2. By some reason, all tests print the warning.
  3. Warning text will be better without !!!. It is not so urgent.
@An-Tu

This comment has been minimized.

Contributor

An-Tu commented Jun 2, 2018

Is need to remove warning from all tests? Because "years" and "since" tests use releseDate which older than six month.

@ai

This comment has been minimized.

Member

ai commented Jun 2, 2018

Yeap. Right now test output is noisy. You can fix this tests.

@An-Tu

This comment has been minimized.

Contributor

An-Tu commented Jun 2, 2018

Ok, I got it

@An-Tu

This comment has been minimized.

Contributor

An-Tu commented Jun 3, 2018

Unfortunately, I don't know how to reduce the limit :(

@ai

This comment has been minimized.

Member

ai commented Jun 3, 2018

Awesome 👍

I put your name to the Cult of Martians task, but will merge it and release only after PiterCSS (need more time for slides).

@An-Tu

This comment has been minimized.

Contributor

An-Tu commented Jun 3, 2018

Hooray, Thak you! It was my first PR to the open-source project.
See you at PiterCSS =)

@ai

This comment has been minimized.

Member

ai commented Jun 3, 2018

Find me on piterCSS. I will give a sockets to you.

@ai ai changed the base branch from master to v4 Jun 13, 2018

@ai ai merged commit efe2654 into browserslist:v4 Jun 13, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ai ai referenced this pull request Jun 13, 2018

Closed

Outdated caniuse-lite warning #261

ai added a commit that referenced this pull request Jun 21, 2018

Added caniuse-lite browsers release date check (#267)
* Added caniuse-lite browsers release date check

* Node.js checkCanIUse - was amended time constant to update canius, now we look for package.json too. Update release test. Years test - added now's method to the mocked Date

* Remove warning from test output. Increase size limit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment