Skip to content
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

chore: warn to stdout instead of stderr #580

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion node.js
Expand Up @@ -370,7 +370,7 @@ module.exports = {
var halfYearAgo = Date.now() - TIME_TO_UPDATE_CANIUSE

if (latest !== 0 && latest < halfYearAgo) {
console.warn(
console.info(
'Browserslist: caniuse-lite is outdated. Please run:\n' +
'npx browserslist@latest --update-db\n' +
'\n' +
Expand Down
10 changes: 5 additions & 5 deletions test/release.test.ts
Expand Up @@ -85,7 +85,7 @@ let originSxists = fs.existsSync
let originStat = fs.statSync

beforeEach(() => {
jest.spyOn(console, 'warn').mockImplementation(() => true)
jest.spyOn(console, 'info').mockImplementation(() => true)
})

afterEach(() => {
Expand All @@ -103,15 +103,15 @@ afterAll(() => {
it('does not print warning', () => {
browserslist.data = youngerSixMonthsData
browserslist('last 2 versions')
expect(console.warn).toHaveBeenCalledTimes(0)
expect(console.info).toHaveBeenCalledTimes(0)
})

it('shows warning', () => {
browserslist.data = olderSixMonthsData
fs.existsSync = findPackage
fs.statSync = mockStatSync
browserslist('last 2 versions')
expect(console.warn).toHaveBeenCalledWith(
expect(console.info).toHaveBeenCalledWith(
'Browserslist: caniuse-lite is outdated. Please run:\n' +
'npx browserslist@latest --update-db\n' +
'\n' +
Expand All @@ -126,7 +126,7 @@ it('hides warning on request', () => {
fs.existsSync = findPackage
fs.statSync = mockStatSync
browserslist('last 2 versions')
expect(console.warn).toHaveBeenCalledTimes(0)
expect(console.info).toHaveBeenCalledTimes(0)
})

it('shows warning only once', () => {
Expand All @@ -135,5 +135,5 @@ it('shows warning only once', () => {
fs.statSync = mockStatSync
browserslist('last 2 versions')
browserslist('last 2 versions')
expect(console.warn).toHaveBeenCalledTimes(1)
expect(console.info).toHaveBeenCalledTimes(1)
})