-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk-analytics) fix test in ci/cd
- Loading branch information
Showing
18 changed files
with
1,124 additions
and
457 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@nx/react/babel", | ||
{ | ||
"runtime": "automatic", | ||
"useBuiltIns": "usage" | ||
} | ||
] | ||
], | ||
"plugins": [] | ||
} |
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 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,29 +1,21 @@ | ||
/* eslint-disable */ | ||
import { readFileSync } from 'fs'; | ||
|
||
// Reading the SWC compilation config and remove the "exclude" | ||
// for the test files to be compiled by SWC | ||
const { exclude: _, ...swcJestConfig } = JSON.parse(readFileSync(`${__dirname}/.swcrc`, 'utf-8')); | ||
|
||
// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves. | ||
// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude" | ||
if (swcJestConfig.swcrc === undefined) { | ||
swcJestConfig.swcrc = false; | ||
} | ||
|
||
// Uncomment if using global setup/teardown files being transformed via swc | ||
// https://nx.dev/nx-api/jest/documents/overview#global-setupteardown-with-nx-libraries | ||
// jest needs EsModule Interop to find the default exported setup/teardown functions | ||
// swcJestConfig.module.noInterop = false; | ||
|
||
export default { | ||
displayName: 'analytics', | ||
displayName: 'sdk-analytics', | ||
preset: '../../../jest.preset.js', | ||
transform: { | ||
'^.+\\.[tj]sx?$': ['@swc/jest', swcJestConfig] | ||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', | ||
'^.+\\.[tj]sx?$': [ | ||
'babel-jest', | ||
{ | ||
presets: ['@nx/react/babel'], | ||
plugins: [ | ||
['@babel/plugin-proposal-private-methods', { loose: true }], | ||
['@babel/plugin-proposal-private-property-in-object', { loose: true }], | ||
['@babel/plugin-proposal-class-properties', { loose: true }] | ||
] | ||
} | ||
] | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
testEnvironment: 'jsdom', | ||
coverageDirectory: '../../../coverage/libs/sdk/analytics', | ||
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'] | ||
coverageDirectory: '../../../coverage/libs/sdk/analytics' | ||
}; |
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.
2 changes: 1 addition & 1 deletion
2
core-web/libs/sdk/analytics/src/lib/react/components/DotContentAnalyticsProvider.spec.tsx
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../dist/libs/sdk/analytics", | ||
"types": ["node", "@nx/react/typings/cssmodule.d.ts", "@nx/react/typings/image.d.ts"] | ||
"outDir": "../../../dist/out-tsc", | ||
"types": [ | ||
"node", | ||
"@nx/react/typings/cssmodule.d.ts", | ||
"@nx/react/typings/image.d.ts", | ||
"vite/client" | ||
] | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.tsx"], | ||
"exclude": [ | ||
"jest.config.ts", | ||
"src/**/*.spec.ts", | ||
"src/**/*.test.ts", | ||
"src/**/*.spec.tsx", | ||
"src/**/*.test.tsx", | ||
"src/**/*.spec.js", | ||
"src/**/*.test.js", | ||
"src/**/*.spec.jsx", | ||
"src/**/*.test.jsx" | ||
] | ||
"**/*.spec.ts", | ||
"**/*.test.ts", | ||
"**/*.spec.tsx", | ||
"**/*.test.tsx", | ||
"**/*.spec.js", | ||
"**/*.test.js", | ||
"**/*.spec.jsx", | ||
"**/*.test.jsx" | ||
], | ||
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] | ||
} |
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,48 @@ | ||
/// <reference types='vitest' /> | ||
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; | ||
import react from '@vitejs/plugin-react'; | ||
import * as path from 'path'; | ||
import { defineConfig } from 'vite'; | ||
import dts from 'vite-plugin-dts'; | ||
|
||
export default defineConfig({ | ||
root: __dirname, | ||
cacheDir: '../../../node_modules/.vite/libs/sdk/sdk-analytics', | ||
|
||
plugins: [ | ||
react(), | ||
nxViteTsPaths(), | ||
dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') }) | ||
], | ||
|
||
// Uncomment this if you are using workers. | ||
// worker: { | ||
// plugins: [ nxViteTsPaths() ], | ||
// }, | ||
|
||
// Configuration for building your library. | ||
// See: https://vitejs.dev/guide/build.html#library-mode | ||
build: { | ||
outDir: '../../../dist/libs/sdk/sdk-analytics', | ||
emptyOutDir: true, | ||
reportCompressedSize: true, | ||
commonjsOptions: { | ||
transformMixedEsModules: true | ||
}, | ||
lib: { | ||
entry: { | ||
index: 'src/index.ts', | ||
'react/index': 'src/lib/react/index.ts' | ||
}, | ||
formats: ['es'] | ||
}, | ||
rollupOptions: { | ||
external: ['react', 'react-dom', 'react/jsx-runtime'], | ||
output: { | ||
exports: 'named', | ||
preserveModules: true, | ||
preserveModulesRoot: 'src' | ||
} | ||
} | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.