Skip to content

Commit

Permalink
fix(node): Upgrade to Node 16
Browse files Browse the repository at this point in the history
Features:
- upgrade Node version in 16
- set preset env node version 16 inside babel-preset-cozy-app
- use Node 16 on travis CI

Fix install:
- babel dependencies in yarn.lock to fix @babel/helper-plugin-utils
broken

Fix Lint:
- prevent linting of react/display-name on spec files.

  Fix Test:
- move and mock KonnectorUpdateInfos.spec.jsx because it randomly fails.
- asynchronous tests need to return waitFor to prevent running after
tests end
  • Loading branch information
trollepierre committed Aug 1, 2022
1 parent cc99d8c commit 3a82521
Show file tree
Hide file tree
Showing 8 changed files with 348 additions and 920 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
16
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- '12'
- '16'
cache:
yarn: true
directories:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: 'Repo Doctor'
script: '[ $TRAVIS_EVENT_TYPE = "cron" ] && pushd ./packages/repo-doctor && yarn start:mattermost && popd || true'
- name: 'Tests'
script:
script:
- ./scripts/travis.sh

env:
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-cozy-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const presetEnvBrowserOptions = {

const presetEnvNodeOptions = {
targets: {
node: 12
node: 16
},
// don't transform polyfills
useBuiltIns: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('BIContractActivationWindow', () => {
const { getByRole } = setup()
await act(async () => {
await waitFor(() => {
expect(getByRole('button').getAttribute('class')).not.toContain(
return expect(getByRole('button').getAttribute('class')).not.toContain(
'Mui-disabled'
)
})
Expand All @@ -72,7 +72,7 @@ describe('BIContractActivationWindow', () => {
await act(async () => {
fireEvent.click(getByRole('button'))
await waitFor(() => {
expect(refreshContracts).toHaveBeenCalled()
return expect(refreshContracts).toHaveBeenCalled()
})
})

Expand All @@ -91,7 +91,7 @@ describe('BIContractActivationWindow', () => {
const { getByRole } = setup()
await act(async () => {
await waitFor(() => {
expect(getByRole('button').getAttribute('class')).not.toContain(
return expect(getByRole('button').getAttribute('class')).not.toContain(
'Mui-disabled'
)
})
Expand All @@ -100,7 +100,7 @@ describe('BIContractActivationWindow', () => {
await act(async () => {
fireEvent.click(getByRole('button'))
await waitFor(() => {
expect(refreshContracts).toHaveBeenCalled()
return expect(refreshContracts).toHaveBeenCalled()
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('KonnectorModal', () => {

it('should show a spinner while loading', async () => {
const { root } = setup()
waitFor(() => root.getByRole('progressbar'))
return waitFor(() => root.getByRole('progressbar'))
})

it('should show an error view', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@
import React from 'react'
import { render } from '@testing-library/react'

import AppLike from '../../test/AppLike'
import AppLike from '../../../test/AppLike'
import KonnectorUpdateInfos from 'components/infos/KonnectorUpdateInfos'

jest.mock(
'../KonnectorUpdateLinker',
() =>
({ konnector, label, isBlocking }) =>
(
<div
data-testtid="KonnectorUpdateLinker"
data-label={label}
data-konnector={konnector}
data-is-blocking={isBlocking}
/>
)
)

// Default props
const intents = {
redirect: jest.fn()
Expand Down
6 changes: 6 additions & 0 deletions packages/eslint-config-cozy-app/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-function-return-type': 'error'
}
},
{
files: ['**/*.spec.jsx', '**/*.spec.js', '**/*.spec.tsx', '**/*.spec.ts'],
rules: {
'react/display-name': ['off']
}
}
]
}

0 comments on commit 3a82521

Please sign in to comment.