Gonçalo Teixeira
08/18/2023, 8:53 AM<rootDir>/node_modules/@gooddata/sdk-model/esm/index.js:13
export { DateGranularity } from "./base/dateGranularities.js";
^^^^^^
SyntaxError: Unexpected token 'export'
have you ever faced this? This started happening after updating to v9Radek Novacek
08/18/2023, 2:34 PMGonçalo Teixeira
08/18/2023, 10:32 PMRadek Novacek
08/21/2023, 11:35 AMGonçalo Teixeira
08/22/2023, 7:47 AM{
"name": "<omitted>",
"author": "<omitted>",
"version": "4.0.0-next.4",
"private": true,
"scripts": {
"dev": "next dev",
"dev:pretty": "next dev | npx pino-pretty",
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:ci": "next lint --max-warnings 0",
"lint:fix": "next lint --fix",
"prettier:check": "prettier --check ./src",
"prettier:fix": "prettier --write ./src",
"test": "jest",
"test:coverage": "jest --coverage --watchAll=false",
"test:update": "jest -u",
"checkTs:ci": "tsc --noEmit --skipLibCheck"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"engines": {
"pnpm": ">=8.0.0 <9.0.0",
"node": ">=18.0.0"
},
"packageManager": "pnpm@8.6.3",
"dependencies": {
"@ag-grid-community/core": "~25.3.0",
"@babel/runtime": ">=7.0.0 <8.0.0",
"@emotion/cache": "11.10.5",
"@emotion/react": "^11.11.1",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@floating-ui/react": "^0.24.3",
"@fontsource/poppins": "5.0.5",
"@gooddata/api-client-tiger": "9.0.1",
"@gooddata/sdk-backend-base": "9.0.1",
"@gooddata/sdk-backend-tiger": "9.0.1",
"@gooddata/sdk-model": "9.0.1",
"@gooddata/sdk-ui": "9.0.1",
"@gooddata/sdk-ui-all": "9.0.1",
"@gooddata/sdk-ui-charts": "9.0.1",
"@gooddata/sdk-ui-dashboard": "9.0.1",
"@gooddata/sdk-ui-ext": "9.0.1",
"@gooddata/sdk-ui-filters": "9.0.1",
"@gooddata/sdk-ui-geo": "9.0.1",
"@gooddata/sdk-ui-kit": "9.0.1",
"@gooddata/sdk-ui-loaders": "9.0.1",
"@gooddata/sdk-ui-pivot": "9.0.1",
"@gooddata/sdk-ui-theme-provider": "9.0.1",
"@growthbook/growthbook": "0.27.0",
"@growthbook/growthbook-react": "0.17.0",
"@mui/icons-material": "^5.14.1",
"@mui/lab": "5.0.0-alpha.134",
"@mui/material": "^5.14.2",
"@mui/system": "^5.14.1",
"@mui/x-data-grid": "^6.9.0",
"@next/font": "13.4.12",
"@react-buddy/ide-toolbox-next": "^2.4.0",
"@react-buddy/palette-mui": "^5.0.1",
"@reduxjs/toolkit": "^1.9.3",
"@sentry/nextjs": "7.60.1",
"@sgratzl/chartjs-chart-boxplot": "4.1.1",
"@types/node": "18.14.4",
"chart.js": "4.2.1",
"csstype": "^3.0.10",
"date-fns": "^2.29.3",
"eslint-config-next": "13.4.12",
"install": "0.13.0",
"jose": "^4.13.1",
"lodash": "4.17.21",
"mixpanel-browser": "^2.45.0",
"next": "13.4.12",
"next-auth": "^4.22.3",
"next-redux-wrapper": "^8.1.0",
"nextjs-progressbar": "0.0.16",
"notistack": "^3.0.1",
"pino": "^8.11.0",
"prop-types": "^15.6.0",
"react": "^18.2.0",
"react-chartjs-2": "5.2.0",
"react-copy-to-clipboard": "^5.1.0",
"react-dom": "^18.2.0",
"react-pdf": "^7.1.2",
"react-redux": "^8.0.5",
"recharts": "2.4.3",
"redux": ">=4.0.0 <5.0.0",
"redux-saga": "1.2.2"
},
"devDependencies": {
"@babel/core": "7.22.10",
"@babel/preset-env": "7.22.10",
"@babel/preset-react": "7.22.5",
"@babel/preset-typescript": "7.22.5",
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"@jest/globals": "29.6.2",
"@semantic-release/changelog": "6.0.2",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/gitlab": "9.5.1",
"@testing-library/dom": ">=7.21.4",
"@testing-library/jest-dom": "5.17.0",
"@testing-library/react": "14.0.0",
"@testing-library/react-hooks": "7.0.2",
"@testing-library/user-event": "14.4.3",
"@types/jest": "^26.0.23",
"@types/lodash": "4.14.191",
"@types/react": "18.2.17",
"@types/react-dom": "18.2.7",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"babel-jest": "29.6.2",
"babel-plugin-dynamic-import-node": "^2.3.3",
"conventional-changelog-conventionalcommits": "^5.0.0",
"eslint": "^8.45.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-security": "^1.7.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-sonarjs": "^0.19.0",
"husky": "^8.0.3",
"jest": "29.6.2",
"jest-environment-jsdom": "29.6.2",
"jest-junit": "^16.0.0",
"jest-next-dynamic": "^1.0.1",
"jest-resolver-enhanced": "1.1.0",
"lint-staged": "^13.1.2",
"pino-pretty": "^10.0.0",
"prettier": "^3.0.0",
"semantic-release": "19",
"ts-jest": "29.1.1",
"typescript": "5.1.6"
}
}
Ivan Mjartan
08/22/2023, 9:30 AMtransformIgnorePatterns: [
// transform ignore esm packages so that Jest can use them
"/node_modules/(?!@gooddata).+\\.js$",
],
Pls I wrote the ignore pattern blindly not tested hope it will work. Let us know if this help.Ivan Mjartan
08/22/2023, 9:40 AMGonçalo Teixeira
08/22/2023, 10:00 AM// eslint-disable-next-line @typescript-eslint/no-var-requires
const nextJest = require('next/jest');
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
});
// Add any custom config to be passed to Jest
/** @type {import("jest").Config} */
const customJestConfig = {
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
testEnvironment: 'jest-environment-jsdom',
collectCoverageFrom: [...],
resetMocks: false,
coverageThreshold: {
global: {
branches: 80,
functions: 85,
lines: 95,
statements: 95,
},
},
transformIgnorePatterns: ['node_modules/(?!@gooddata).+\\.js$'],
coverageReporters: [
'json',
'lcov',
'text',
'clover',
'cobertura',
'html',
'text-summary',
],
testResultsProcessor: 'jest-junit',
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
};
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig);
Ivan Mjartan
08/22/2023, 10:56 AMIvan Mjartan
08/22/2023, 10:59 AMconst defaultConfig = {
transform: {
"^.+\\.(t|j)sx?$": ["@swc/jest"],
},
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
modulePathIgnorePatterns: ["<rootDir>/.*/__mocks__"],
transformIgnorePatterns: [
// transform esm packages so that Jest can use them
"/node_modules/(?!intl-messageformat|intl-messageformat-parser|@gooddata|uuid|@hookform|default-import|node-fetch|data-uri-to-buffer|fetch-blob|formdata-polyfill).+\\.js$",
],
moduleFileExtensions: ["js", "jsx", "ts", "tsx", "json", "node"],
snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
};
as transformer we are using this
@swc/jest
Gonçalo Teixeira
08/22/2023, 1:01 PMGonçalo Teixeira
08/22/2023, 1:41 PMIvan Mjartan
08/22/2023, 1:45 PMIvan Mjartan
08/22/2023, 1:47 PMGonçalo Teixeira
08/22/2023, 2:32 PMIvan Mjartan
08/22/2023, 2:48 PMGonçalo Teixeira
08/22/2023, 2:49 PMIvan Mjartan
08/22/2023, 2:53 PMGonçalo Teixeira
08/22/2023, 2:54 PMit
, describe
and expect
into test files, and renaming references from jest
to vi