Skip to content

Commit

Permalink
Next v12 upgrade (#34)
Browse files Browse the repository at this point in the history
* upgrade to next v12
* removed babel for swc
* npm updates including msw and lint
* azure pipeline now builds with node v16

* swc/jest is not reporting coverage correctly https://github.com/swc-project/jest/issues/21
  • Loading branch information
FreakinWard committed Dec 8, 2021
1 parent 49887de commit cc07093
Show file tree
Hide file tree
Showing 12 changed files with 10,497 additions and 16,264 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ yarn-error.log*
#story-book
/storybook-static
/docs-build

# jetbrains
.idea/sonarlint
7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ stages:
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
versionSpec: '16.x'
displayName: 'Install Node.js'

- script: |
Expand Down
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

21 changes: 13 additions & 8 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const nextJest = require('next/jest');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageJson = require('./package.json');

module.exports = {
// Providing the path to your Next.js app which will enable loading next.config.js and .env files
const createJestConfig = nextJest({ dir: '.' });

// Any custom config you want to pass to Jest
const customJestConfig = {
testEnvironment: 'jsdom',
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'],
setupFilesAfterEnv: ['./jest.setup.js'],
moduleNameMapper: {
// Resolve .css and similar files to identity-obj-proxy instead.
'.+\\.(css|styl|less|sass|scss)$': `identity-obj-proxy`,
// Resolve .jpg and similar files to __mocks__/file-mock.js
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': `<rootDir>/__mocks__/file-mock.js`,
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }],
},
coveragePathIgnorePatterns: ['src/core/mocks'],
coverageThreshold: {
Expand All @@ -35,3 +37,6 @@ module.exports = {
],
coverageReporters: ['text', 'cobertura', 'lcov'],
};

// createJestConfig is exported in this way to ensure that next/jest can load the Next.js configuration, which is async
module.exports = createJestConfig(customJestConfig);
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ module.exports = withBundleAnalyzer({
publicRuntimeConfig: {
appInsightsConnectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING,
},
swcMinify: true,
});

0 comments on commit cc07093

Please sign in to comment.