Comments (9)
Обновлены все зависимости за исключением:
- get-port: предпологаю, что нужно обноить зависимости из корневого package.json. А потом нашел подтверждение и в прошлых обновлениях этого реппо #237 (comment)
-node-fetch (https://www.npmjs.com/package/node-fetch) При обновлении до 2.7.0 всё норм, а если 3.3.2 то test unit ругается и с этим я пока что завис(( .
Склоняюсь к мысли, что это не относящаяся к проекту проблемма, т.к. видел, что в другом issues эту зависимость обновили до максимальной.
Как исправить пока что не нашёл путь, если кто подскажет - буду благодарен.
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.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
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:
/home/uladzimir/.yarn/berry/cache/node-fetch-npm-3.3.2-5267e015f2-9.zip/node_modules/node-fetch/src/index.js:9
import http from 'node:http';
^^^^^^
SyntaxError: Cannot use import statement outside a module
6 | import { Response } from 'node-fetch'
7 |
> 8 | import { ExpressExternalRendererView } from './express-external-renderer.view'
| ^
9 |
10 | const mockedFetch = jest.mocked(fetch, true)
11 |
at Runtime.createScriptFromCode (../../../../../.yarn/berry/cache/jest-runtime-npm-27.5.1-c106eea3ba-9.zip/node_modules/jest-runtime/build/index.js:1728:14)
at Object.<anonymous> (packages/external-renderer/src/renderer/express-external-renderer.view.test.ts:8:38)
PASS packages/typesense/src/decorators/field.decorator.test.ts
PASS packages/typesense/src/metadata/typesense.metadata-explorer.test.ts
PASS packages/kratos/src/interceptors/kratos-redirect.interceptor.test.ts
PASS packages/hydra/src/module/hydra.module.test.ts
PASS packages/kratos/src/filters/kratos-exception.filter.test.ts
PASS packages/kratos/src/module/kratos.module.test.ts
FAIL packages/external-renderer/src/module/external-renderer.module.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.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
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:
/home/uladzimir/.yarn/berry/cache/node-fetch-npm-3.3.2-5267e015f2-9.zip/node_modules/node-fetch/src/index.js:9
import http from 'node:http';
^^^^^^
SyntaxError: Cannot use import statement outside a module
5 | query?: object
6 | headers?: object
> 7 | }
| ^
8 |
9 | export class ExpressExternalRendererView {
10 | path: string
at Runtime.createScriptFromCode (../../../../../.yarn/berry/cache/jest-runtime-npm-27.5.1-c106eea3ba-9.zip/node_modules/jest-runtime/build/index.js:1728:14)
at Object.<anonymous> (packages/external-renderer/src/renderer/express-external-renderer.view.ts:7:38)
PASS packages/typesense/src/module/typesense.module.test.ts
PASS packages/signed-url/src/tests/generate-url.test.ts
PASS packages/typeorm-seeding/src/module/typeorm-seeding.module.test.ts
➤ YN0000: Done in 5s 905ms
Test Suites: 2 failed, 9 passed, 11 total
Tests: 27 passed, 27 total
Snapshots: 0 total
Time: 4.861 s
Ran all test suites.
from nestjs.
@RimidalU У меня была похожая ошибка в другом проекте, знаю что надо копать в репозиторий tools
и смотреть как ярн делает тесты, но у меня до этого пока руки не дошли. А может у тебя и другой случай
from nestjs.
@TorinAsakura , остановиться на версии 2.7 или копать дальше? И, подскажи, плиз, в каком напралении?
from nestjs.
Подборка версий это нормально, как и решение проблем связанных с этим
from nestjs.
@RimidalU Можешь сделать пулл реквест со своей веткой. Он будет висеть пока вопрос не решится, а потом когда все согласуем и апрувнем то смержим.
from nestjs.
1. get-port обновлён до 6.1.2 (latest 7.0.0) при использовании версии 7.0 возникает ошибка:
➤ YN0000: ┌ Typecheck
➤ YN0000: │ ../../../../../.yarn/berry/cache/get-port-npm-7.0.0-72b8a92f99-9.zip/node_modules/get-port/index.d.ts
➤ YN0000: │
➤ YN0000: │ Error: Module '"node:net"' has no exported member 'type'.
➤ YN0000: │
➤ YN0000: │
➤ YN0000: │ ../../../../../.yarn/berry/cache/get-port-npm-7.0.0-72b8a92f99-9.zip/node_modules/get-port/index.d.ts
➤ YN0000: │
➤ YN0000: │ Error: ',' expected.
возникает она потому что в либе сменили interface на type (sindresorhus/get-port@v6.1.2...v7.0.0)
а при проверке yarn check
typecheck пробегается typescript: '^4.5.3', который не занет о type.
Отсюда и вторая ошибка про зарятую - ему не понятно почему два значение не разделили запятой
Поэтому после поднятия версии ts можно будет поднять и эту.
2. node-fetch обновлён до 2.7.0 (latest 3.3.2) при использовании версии 3.3.2 возникает ошибка:
SyntaxError: Cannot use import statement outside a module
5 | export class ExpressExternalRendererView {
6 | path: string
> 7 |
| ^
8 | baseUrl: string
9 |
10 | constructor(name, options) {
at Runtime.createScriptFromCode (../../../../../.yarn/berry/cache/jest-runtime-npm-27.5.1-c106eea3ba-9.zip/node_modules/jest-runtime/build/index.js:1728:14)
at Object.<anonymous> (packages/external-renderer/src/renderer/express-external-renderer.view.ts:7:38)
Варианты, которые я вижу поднять версию ноды (node-fetch/node-fetch#1588) (совет автора либы) или понизить на предыдущую версию, что я и сделал.
from nestjs.
- используй packageExtension для решения проблем совместимости типов в зависимостях (пример можешь подсмотреть в .yarnrc.yml)
- версия ноды у нас 18, ниже опускать не рекомендую, не будут работать ярн утилиты
- фиксируй версии, включая версию ТС, нужно подобрать подходящую
from nestjs.
1. get-port обновлён до 6.1.2 (latest 7.0.0) при использовании версии 7.0 возникает ошибка: решено
- node-fetch обновлён до 2.7.0 (latest 3.3.2) при использовании версии 3.3.2 возникает ошибка:
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.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
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:
/home/uladzimir/.yarn/berry/cache/node-fetch-npm-3.3.2-5267e015f2-9.zip/node_modules/node-fetch/src/index.js:9
import http from 'node:http';
^^^^^^
SyntaxError: Cannot use import statement outside a module
5 | query?: object
6 | headers?: object
> 7 | }
| ^
8 |
9 | export class ExpressExternalRendererView {
10 | path: string
at Runtime.createScriptFromCode (../../../../../.yarn/berry/cache/jest-runtime-npm-27.5.1-c106eea3ba-9.zip/node_modules/jest-runtime/build/index.js:1728:14)
at Object.<anonymous> (packages/external-renderer/src/renderer/express-external-renderer.view.ts:7:38)
Варианты, которые я вижу: использовать нативный нодовский fetch (node-fetch/node-fetch#1588) (совет автора либы) или понизить на предыдущую версию, что я и сделал.
from nestjs.
Приемлемо
from nestjs.
Related Issues (20)
- [bug] nestjs-map-errors-interceptor works incorrectly with nestjs >7 HOT 1
- NestJS Gateway Type
- Connection isn't provided HOT 1
- Обновление grpc-playground HOT 21
- Обновление grpc-errors
- Обновление grpc-http-proxy
- Обновление `grpc-identity` HOT 5
- Обновление `grpc-reflection` HOT 3
- Обновление зависимостей `dataloader` HOT 8
- Обновление зависимостей `gateway` HOT 9
- Обновление зависимостей `hydra`
- Обновление зависимостей `keto` HOT 4
- Обновление зависимостей `kratos` HOT 4
- Обновление зависимостей `logger`
- Обновление зависимостей `signed-url` HOT 2
- Обновление зависимостей `typeorm-seeding`
- Обновление зависимостей `typesense` HOT 1
- Обновление зависимостей `typesense-typeorm` HOT 1
- Адаптер `keto-grpc` HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nestjs.