FAIL src/modules/_common/k8s/services/k8s-storage-class.service.test.ts
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
D:\project\node_modules\@kubernetes\client-node\dist\index.js:1
({"Object.":function(module,exports,require,__dirname,__filename,jest){export * from './config.js';
^^^^^^
SyntaxError: Unexpected token 'export'
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
at Object. (src/modules/_common/k8s/k8s.config.ts:2:1)
at Object. (src/modules/_common/k8s/services/k8s-storage-class.service.test.ts:3:1)
< /code>
dtsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es2020",
"allowJs": true,
"outDir": "dist",
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true
}
}
< /code>
Jest Config < /p>
{
"verbose": true,
"transform": {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.js$": "babel-jest",
"\\.(yaml|yml)$": "jest-yaml-transform",
"node_modules/@kubernetes/client-node/dist/index.js": [
"ts-jest",
{
"isolatedModules": true
}
]
},
"transformIgnorePatterns": [
"/node_modules/(?!@kubernetes/client-node)/",
"/node_modules/(?!.*.js$)",
"/dist/"
],
"testEnvironment": "node",
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(tsx?)$",
"moduleNameMapper": {
"^@root(.*)$": "$1",
"^@configs(.*)$": "/configs$1",
"^@constants(.*)$": "/src/constants$1",
"^@common(.*)$": "/src/common$1",
"^@core(.*)$": "/src/core$1",
"^@middleware(.*)$": "/src/middleware$1",
"^@modules(.*)$": "/src/modules$1",
"^@utils(.*)$": "/src/utils$1"
},
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"setupFiles": [
"./test.config.ts"
]
}
Jest пытается выполнить файл, который использует синтаксис ES Module (Import/Export), но Jest не настроен должным образом для обработки модулей ES, что приводит к неожиданному токену 'Export' Ошибка.
Я запускаю Jest (версия:^29.7.0) Test Suite в среде Node.js V22 с использованием TypeScript. Используется «@kubernetes /client-node».[code]FAIL src/modules/_common/k8s/services/k8s-storage-class.service.test.ts ● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
By default "node_modules" folder is ignored by transformers.
Here's what you can do: • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. • If you need a custom transformation specify a "transform" option in your config. • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs: https://jestjs.io/docs/configuration For information about custom transformations, see: https://jestjs.io/docs/code-transformation
Details:
D:\project\node_modules\@kubernetes\client-node\dist\index.js:1 ({"Object.":function(module,exports,require,__dirname,__filename,jest){export * from './config.js'; ^^^^^^
SyntaxError: Unexpected token 'export' at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14) at Object. (src/modules/_common/k8s/k8s.config.ts:2:1) at Object. (src/modules/_common/k8s/services/k8s-storage-class.service.test.ts:3:1)
< /code> dtsconfig.json { "compilerOptions": { "module": "commonjs", "target": "es2020", "allowJs": true, "outDir": "dist", "strict": true, "moduleResolution": "node", "esModuleInterop": true, "skipLibCheck": true } } < /code> Jest Config < /p> { "verbose": true, "transform": { "^.+\\.tsx?$": "ts-jest", "^.+\\.js$": "babel-jest", "\\.(yaml|yml)$": "jest-yaml-transform", "node_modules/@kubernetes/client-node/dist/index.js": [ "ts-jest", { "isolatedModules": true } ] }, "transformIgnorePatterns": [ "/node_modules/(?!@kubernetes/client-node)/", "/node_modules/(?!.*.js$)", "/dist/" ], "testEnvironment": "node", "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(tsx?)$", "moduleNameMapper": { "^@root(.*)$": "$1", "^@configs(.*)$": "/configs$1", "^@constants(.*)$": "/src/constants$1", "^@common(.*)$": "/src/common$1", "^@core(.*)$": "/src/core$1", "^@middleware(.*)$": "/src/middleware$1", "^@modules(.*)$": "/src/modules$1", "^@utils(.*)$": "/src/utils$1" }, "moduleFileExtensions": [ "ts", "tsx", "js", "jsx", "json", "node" ], "setupFiles": [ "./test.config.ts" ] } [/code] Jest пытается выполнить файл, который использует синтаксис ES Module (Import/Export), но Jest не настроен должным образом для обработки модулей ES, что приводит к неожиданному токену 'Export' Ошибка.
Я использую kubernetes-client/java API и хочу программно получить статус всех модулей во всех пространствах имен. Мой код основан на этом примере Java-библиотеки Kubernetes.
Я использую kubernetes-client/java API и хочу программно получить статус всех модулей во всех пространствах имен. Мой код основан на этом примере Java-библиотеки Kubernetes.
Я строю приложение React Next с хостингом Vercel. В своем приложении я создал Express API, но теперь мне нужно развернуть его. Я решил развернуть его на Vercel, но я продолжаю получать эту ошибку для моего /векторизационного вызова API!
{
error :...
Модуль A имеет MainActivity и зависит от модулей B,C,D,E.
Из модуля A HomeViewModel я хочу вызвать CityActivity в модуле C.
После выполнения некоторой работы в BoardViewModel, вызванной из CityActivity в модуль C. Я хочу добавить кнопку для возврата...
Я пытаюсь изменить однозначно связанный список в Java, но я сталкиваюсь с путаницей в отношении того, как ссылки работают во время процесса изменения. В частности, я не понимаю, почему установление следующего указателя узла на NULL не влияет на...