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

Feature: updated to Jest27 and ts43 #67

Merged
merged 8 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/fresh-teachers-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'blog-app': minor
'web-app': minor
'@your-org/core-lib': minor
'@your-org/ui-lib': minor
---

Jest 27 and Typescript 4.3.1
13 changes: 8 additions & 5 deletions apps/blog-app/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @ts-check
'use strict';

const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { defaults: tsjPreset } = require('ts-jest/presets');
const { pathsToModuleNameMapper, createJestPreset } = require('ts-jest/utils');
const { defaults: tsPreset } = require('ts-jest/presets');

const { compilerOptions: baseTsConfig } = require('./tsconfig.json');

Expand All @@ -15,7 +16,7 @@ const getTsConfigBasePaths = () => {
: {};
};

/** @typedef {import('ts-jest')} */
/** @typedef {import('ts-jest/dist/types')} */
/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
name: 'blog-app:unit',
Expand All @@ -24,7 +25,7 @@ const config = {
verbose: true,
rootDir: './src',
transform: {
...tsjPreset.transform,
...tsPreset.transform,
'^.+\\.css$': '<rootDir>/../config/jest/css-transform.js',
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)':
'<rootDir>/../config/jest/file-transform.js',
Expand All @@ -38,7 +39,9 @@ const config = {
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
...getTsConfigBasePaths(),
},
coverageDirectory: '<rootDir>/coverage',
// false by default, overrides in cli, ie: yarn test:unit --collect-coverage=true
collectCoverage: false,
coverageDirectory: '<rootDir>/../coverage',
collectCoverageFrom: ['<rootDir>/**/*.{ts,tsx,js,jsx}', '!**/*.test.ts'],
globals: {
'ts-jest': {
Expand Down
18 changes: 9 additions & 9 deletions apps/blog-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dev": "next",
"build": "next build",
"vercel-build": "yarn share:static:hardlink && cross-env NEXTJS_BUILD_TARGET=serverless next build",
"clean": "rimraf --no-glob ./.next ./out",
"clean": "rimraf --no-glob ./.next ./out ./coverage && jest --clear-cache",
"export": "next export",
"start": "next start",
"?share:static:symlink": "echo 'Use this command to link assets, locales... from shared static folder'",
Expand All @@ -39,14 +39,14 @@
"@tailwindcss/typography": "^0.4.1",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"@testing-library/react-hooks": "^6.0.0",
"@testing-library/react-hooks": "^7.0.0",
"@types/jest": "^26.0.23",
"@types/node": "^15.6.1",
"@types/react": "^17.0.7",
"@types/react": "^17.0.8",
"@types/react-dom": "^17.0.5",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"autoprefixer": "^10.2.5",
"autoprefixer": "^10.2.6",
"camelcase": "^6.2.0",
"cross-env": "^7.0.3",
"eslint": "^7.27.0",
Expand All @@ -58,9 +58,9 @@
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-cli": "^26.6.3",
"jest": "^27.0.1",
"jest-circus": "^27.0.1",
"jest-cli": "^27.0.1",
"next-transpile-modules": "^7.2.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.0",
Expand All @@ -70,8 +70,8 @@
"symlink-dir": "^5.0.1",
"sync-directory": "^2.2.22",
"tailwindcss": "^2.1.2",
"ts-jest": "^26.5.6",
"typescript": "^4.2.4"
"ts-jest": "^27.0.1",
"typescript": "^4.3.2"
},
"dependencies": {
"@emotion/react": "^11.4.0",
Expand Down
2 changes: 2 additions & 0 deletions apps/blog-app/tsconfig.jest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"noEmit": true,
"sourceMap": false,
"declarationMap": false,
"incremental": true,
"noImplicitAny": false,
"declaration": false,
Expand Down
13 changes: 8 additions & 5 deletions apps/web-app/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @ts-check
'use strict';

const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { defaults: tsjPreset } = require('ts-jest/presets');
const { pathsToModuleNameMapper, createJestPreset } = require('ts-jest/utils');
const { defaults: tsPreset } = require('ts-jest/presets');

const { compilerOptions: baseTsConfig } = require('./tsconfig.json');

Expand All @@ -15,7 +16,7 @@ const getTsConfigBasePaths = () => {
: {};
};

/** @typedef {import('ts-jest')} */
/** @typedef {import('ts-jest/dist/types')} */
/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
name: 'web-app:unit',
Expand All @@ -24,7 +25,7 @@ const config = {
verbose: true,
rootDir: './src',
transform: {
...tsjPreset.transform,
...tsPreset.transform,
'^.+\\.css$': '<rootDir>/../config/jest/css-transform.js',
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)':
'<rootDir>/../config/jest/file-transform.js',
Expand All @@ -38,7 +39,9 @@ const config = {
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
...getTsConfigBasePaths(),
},
coverageDirectory: '<rootDir>/coverage',
// false by default, overrides in cli, ie: yarn test:unit --collect-coverage=true
collectCoverage: false,
coverageDirectory: '<rootDir>/../coverage',
collectCoverageFrom: ['<rootDir>/**/*.{ts,tsx,js,jsx}', '!**/*.test.ts'],
globals: {
'ts-jest': {
Expand Down
20 changes: 10 additions & 10 deletions apps/web-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dev": "next",
"build": "next build",
"vercel-build": "yarn share:static:hardlink && cross-env NEXTJS_BUILD_TARGET=serverless next build",
"clean": "rimraf --no-glob ./.next ./out",
"clean": "rimraf --no-glob ./.next ./out ./coverage && jest --clear-cache",
"start": "next start",
"prisma:migrate:reset": "dotenv-flow -- yarn prisma migrate reset",
"prisma:db:seed": "dotenv-flow -- yarn prisma db seed --preview-feature",
Expand Down Expand Up @@ -46,15 +46,15 @@
"@tailwindcss/typography": "^0.4.1",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"@testing-library/react-hooks": "^6.0.0",
"@testing-library/react-hooks": "^7.0.0",
"@types/cors": "^2.8.10",
"@types/jest": "^26.0.23",
"@types/node": "^15.6.1",
"@types/react": "^17.0.7",
"@types/react": "^17.0.8",
"@types/react-dom": "^17.0.5",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"autoprefixer": "^10.2.5",
"autoprefixer": "^10.2.6",
"camelcase": "^6.2.0",
"cross-env": "^7.0.3",
"dotenv-flow": "^3.2.0",
Expand All @@ -68,9 +68,9 @@
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-cli": "^26.6.3",
"jest": "^27.0.1",
"jest-circus": "^27.0.1",
"jest-cli": "^27.0.1",
"next-transpile-modules": "^7.2.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.0",
Expand All @@ -82,17 +82,17 @@
"symlink-dir": "^5.0.1",
"sync-directory": "^2.2.22",
"tailwindcss": "^2.1.2",
"ts-jest": "^26.5.6",
"ts-jest": "^27.0.1",
"ts-node": "^10.0.0",
"typescript": "^4.2.4"
"typescript": "^4.3.2"
},
"dependencies": {
"@emotion/react": "^11.4.0",
"@emotion/styled": "^11.3.0",
"@headlessui/react": "^1.2.0",
"@heroicons/react": "^1.0.1",
"@prisma/client": "^2.23.0",
"@tsed/exceptions": "^6.51.0",
"@tsed/exceptions": "^6.52.0",
"@your-org/core-lib": "workspace:*",
"@your-org/ui-lib": "workspace:*",
"cors": "^2.8.5",
Expand Down
1 change: 1 addition & 0 deletions apps/web-app/tsconfig.jest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"noEmit": true,
"sourceMap": false,
"incremental": true,
"noImplicitAny": false,
"declaration": false,
Expand Down
7 changes: 5 additions & 2 deletions packages/core-lib/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-check
'use strict';

const { pathsToModuleNameMapper } = require('ts-jest/utils');
Expand All @@ -15,7 +16,7 @@ const getTsConfigBasePaths = () => {
: {};
};

/** @typedef {import('ts-jest')} */
/** @typedef {import('ts-jest/dist/types')} */
/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
name: 'core-lib:unit',
Expand All @@ -38,7 +39,9 @@ const config = {
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
...getTsConfigBasePaths(),
},
coverageDirectory: '<rootDir>/coverage',
// false by default, overrides in cli, ie: yarn test:unit --collect-coverage=true
collectCoverage: false,
coverageDirectory: '<rootDir>/../coverage',
collectCoverageFrom: ['<rootDir>/**/*.{ts,tsx,js,jsx}', '!**/*.test.ts'],
globals: {
'ts-jest': {
Expand Down
18 changes: 9 additions & 9 deletions packages/core-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"build": "microbundle --tsconfig ./tsconfig.build.json --jsx React.createElement --compress",
"build:react17jsx": "microbundle --tsconfig ./tsconfig.build.json --jsx jsx --jsxImportSource react --globals react/jsx-runtime=jsx --compress",
"dev": "microbundle watch",
"clean": "rimraf --no-glob ./dist",
"clean": "rimraf --no-glob ./dist ./coverage && jest --clear-cache",
"lint": "eslint . --ext .ts,.tsx,.js,.jsx",
"typecheck": "tsc --project ./tsconfig.json --noEmit",
"test": "run-s 'test:*'",
Expand All @@ -32,10 +32,10 @@
"devDependencies": {
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"@testing-library/react-hooks": "^6.0.0",
"@testing-library/react-hooks": "^7.0.0",
"@types/jest": "^26.0.23",
"@types/node": "^15.6.1",
"@types/react": "^17.0.7",
"@types/react": "^17.0.8",
"@types/react-dom": "^17.0.5",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
Expand All @@ -49,18 +49,18 @@
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-cli": "^26.6.3",
"microbundle": "^0.13.0",
"jest": "^27.0.1",
"jest-circus": "^27.0.1",
"jest-cli": "^27.0.1",
"microbundle": "^0.13.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"rimraf": "^3.0.2",
"shell-quote": "^1.7.2",
"ts-jest": "^26.5.6",
"typescript": "^4.2.4"
"ts-jest": "^27.0.1",
"typescript": "^4.3.2"
},
"peerDependencies": {
"react": "^16.14.0 || ^17.0.1",
Expand Down
16 changes: 8 additions & 8 deletions packages/ui-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"devDependencies": {
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"@testing-library/react-hooks": "^6.0.0",
"@testing-library/react-hooks": "^7.0.0",
"@types/jest": "^26.0.23",
"@types/node": "^15.6.1",
"@types/react": "^17.0.7",
"@types/react": "^17.0.8",
"@types/react-dom": "^17.0.5",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
Expand All @@ -48,18 +48,18 @@
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-cli": "^26.6.3",
"microbundle": "^0.13.0",
"jest": "^27.0.1",
"jest-circus": "^27.0.1",
"jest-cli": "^27.0.1",
"microbundle": "^0.13.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"rimraf": "^3.0.2",
"shell-quote": "^1.7.2",
"ts-jest": "^26.5.6",
"typescript": "^4.2.4"
"ts-jest": "^27.0.1",
"typescript": "^4.3.2"
},
"peerDependencies": {
"react": "^16.14.0 || ^17.0.1",
Expand Down
Loading