-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from danielr18/update-next-14
Update to support Next 14 / next-redux-wrapper 8
- Loading branch information
Showing
23 changed files
with
7,395 additions
and
19,654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://localhost:3000', | ||
setupNodeEvents(on, config) { | ||
require('@cypress/code-coverage/task')(on, config) | ||
// include any other plugin code... | ||
|
||
// It's IMPORTANT to return the config object | ||
// with any changed environment variables | ||
return config | ||
}, | ||
env: { | ||
codeCoverage: { | ||
url: '/api/__coverage__', | ||
}, | ||
}, | ||
}, | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@cypress/code-coverage/support' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,39 @@ | ||
import App from 'next/app' | ||
import React from 'react' | ||
import { ConnectedRouter } from '../../test-lib' | ||
import { wrapper } from '../store/configure-store' | ||
import App, { AppProps } from 'next/app' | ||
import React, { useEffect, useMemo } from 'react' | ||
import { ConnectedRouter, initialRouterState } from '../../test-lib' | ||
import { customRouterWrapper, wrapper } from '../store/configure-store' | ||
import { Provider } from 'react-redux'; | ||
import Router from 'next/router'; | ||
import { onLocationChanged } from '../../test-lib/actions'; | ||
import locationFromUrl from '../../test-lib/utils/locationFromUrl'; | ||
|
||
class ExampleApp extends App { | ||
render() { | ||
const { Component, pageProps } = this.props | ||
const Wrapper = Component['disableConnectedRouter'] ? React.Fragment : ConnectedRouter; | ||
return ( | ||
export default function ExampleApp({ Component, ...rest }: AppProps) { | ||
const Wrapper = Component['disableConnectedRouter'] ? React.Fragment : ConnectedRouter; | ||
// Hack to support different implementations for the e2e tests | ||
const reduxWrapper = useMemo(() => { | ||
return rest.pageProps?.router === 'custom' ? customRouterWrapper : wrapper; | ||
}, []); | ||
const {store, props} = reduxWrapper.useWrappedStore(rest); | ||
|
||
useEffect(() => { | ||
Router.ready(() => { | ||
store.dispatch(onLocationChanged(locationFromUrl(Router.asPath))); | ||
}); | ||
}, [store]); | ||
|
||
useEffect(() => { | ||
if (typeof window === 'undefined') return; | ||
window['reduxStore'] = store; | ||
return () => { | ||
delete window['reduxStore']; | ||
} | ||
}, [store]); | ||
|
||
return ( | ||
<Provider store={store}> | ||
<Wrapper> | ||
<Component {...pageProps} /> | ||
<Component {...props.pageProps} /> | ||
</Wrapper> | ||
) | ||
} | ||
</Provider> | ||
); | ||
} | ||
|
||
export default wrapper.withRedux(ExampleApp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.