Giter Site home page Giter Site logo

Comments (9)

RimidalU avatar RimidalU commented on May 24, 2024

Обновлены все зависимости за исключением:

  • get-port: предпологаю, что нужно обноить зависимости из корневого package.json. А потом нашел подтверждение и в прошлых обновлениях этого реппо #237 (comment)

-node-fetch (https://www.npmjs.com/package/node-fetch) При обновлении до 2.7.0 всё норм, а если 3.3.2 то test unit ругается и с этим я пока что завис(( .
Склоняюсь к мысли, что это не относящаяся к проекту проблемма, т.к. видел, что в другом issues эту зависимость обновили до максимальной.
Как исправить пока что не нашёл путь, если кто подскажет - буду благодарен.

yarn test unit (node:130696) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (Use `node --trace-deprecation ...` to show where the warning was created) FAIL packages/external-renderer/src/renderer/express-external-renderer.view.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

   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.

SlumberyDude avatar SlumberyDude commented on May 24, 2024

@RimidalU У меня была похожая ошибка в другом проекте, знаю что надо копать в репозиторий tools и смотреть как ярн делает тесты, но у меня до этого пока руки не дошли. А может у тебя и другой случай

from nestjs.

RimidalU avatar RimidalU commented on May 24, 2024

@TorinAsakura , остановиться на версии 2.7 или копать дальше? И, подскажи, плиз, в каком напралении?

from nestjs.

TorinAsakura avatar TorinAsakura commented on May 24, 2024

Подборка версий это нормально, как и решение проблем связанных с этим

from nestjs.

SlumberyDude avatar SlumberyDude commented on May 24, 2024

@RimidalU Можешь сделать пулл реквест со своей веткой. Он будет висеть пока вопрос не решится, а потом когда все согласуем и апрувнем то смержим.

from nestjs.

RimidalU avatar RimidalU commented on May 24, 2024

@TorinAsakura

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)

![image](https://github.com/atls/nestjs/assets/81852394/6a1579a5-12b2-4d33-8715-d80d11ee8ab0)

а при проверке yarn check typecheck пробегается typescript: '^4.5.3', который не занет о type.

![image](https://github.com/atls/nestjs/assets/81852394/ec4abe94-d86c-414f-9990-b6e489bdad28)

Отсюда и вторая ошибка про зарятую - ему не понятно почему два значение не разделили запятой

Поэтому после поднятия версии ts можно будет поднять и эту.

2. node-fetch обновлён до 2.7.0 (latest 3.3.2) при использовании версии 3.3.2 возникает ошибка:

/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 | 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.

TorinAsakura avatar TorinAsakura commented on May 24, 2024

@RimidalU

  • используй packageExtension для решения проблем совместимости типов в зависимостях (пример можешь подсмотреть в .yarnrc.yml)
  • версия ноды у нас 18, ниже опускать не рекомендую, не будут работать ярн утилиты
  • фиксируй версии, включая версию ТС, нужно подобрать подходящую

from nestjs.

RimidalU avatar RimidalU commented on May 24, 2024

@TorinAsakura

1. get-port обновлён до 6.1.2 (latest 7.0.0) при использовании версии 7.0 возникает ошибка: решено

  1. node-fetch обновлён до 2.7.0 (latest 3.3.2) при использовании версии 3.3.2 возникает ошибка:
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)

Варианты, которые я вижу: использовать нативный нодовский fetch (node-fetch/node-fetch#1588) (совет автора либы) или понизить на предыдущую версию, что я и сделал.

from nestjs.

TorinAsakura avatar TorinAsakura commented on May 24, 2024

Приемлемо

from nestjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.