mwootendev / ngx-translate-plugins

Utilities plugins for the @ngx-translate translation library.
MIT License
15 stars 10 forks source link

Tests are not working #37

Closed dhAlcojor closed 2 years ago

dhAlcojor commented 2 years ago

Describe the bug I have just cloned the repo and I've tried to run the tests and they're not working. Nor the app, nor the lib tests.

To Reproduce Steps to reproduce the behavior:

  1. Clone the repo
  2. Install the dependencies with npm install
  3. Run npm run test:appor npm run test:lib
  4. See the errors in the terminal

Expected behavior Tests running successfully.

Desktop (please complete the following information):

Additional context This is the full log of each command.

npm run test:app

 ~/dev/ngx-translate-plugins   develop ±  npm run test:app

> ngx-translate-plugins@0.0.0 test:app
> ng test --project=ngx-translate-plugins

⠙ Generating browser application bundles (phase: building)...20 09 2021 13:17:06.245:WARN [karma]: No captured browser, open http://localhost:9876/
20 09 2021 13:17:06.258:INFO [karma-server]: Karma v5.2.3 server started at http://localhost:9876/
20 09 2021 13:17:06.259:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
20 09 2021 13:17:06.261:INFO [launcher]: Starting browser Chrome
✔ Browser application bundle generation complete.

./src/app/app.component.spec.ts:3:0-63 - Error: Module not found: Error: Can't resolve 'ngx-translate-testing' in '/home/dhalcojor/dev/ngx-translate-plugins/src/app'

Error: src/app/app.component.spec.ts:5:40 - error TS2307: Cannot find module 'ngx-translate-testing' or its corresponding type declarations.

5 import { TranslateTestingModule } from 'ngx-translate-testing';
                                         ~~~~~~~~~~~~~~~~~~~~~~~

20 09 2021 13:17:10.842:INFO [Chrome 93.0.4577.82 (Linux x86_64)]: Connected on socket UD4TUSBejzJh8mqNAAAA with id 81355842
20 09 2021 13:17:10.896:WARN [web-server]: 404: /_karma_webpack_/main.js
Chrome 93.0.4577.82 (Linux x86_64): Executed 0 of 0 SUCCESS (0.001 secs / 0 secs)
TOTAL: 0 SUCCESS
TOTAL: 0 SUCCESS

npm run test:lib

 ~/dev/ngx-translate-plugins   develop ±  npm run test:lib

> ngx-translate-plugins@0.0.0 test:lib
> ng test --project=testing

⠙ Generating browser application bundles (phase: building)...20 09 2021 13:21:57.666:WARN [karma]: No captured browser, open http://localhost:9876/
20 09 2021 13:21:57.680:INFO [karma-server]: Karma v5.2.3 server started at http://localhost:9876/
20 09 2021 13:21:57.680:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
20 09 2021 13:21:57.684:INFO [launcher]: Starting browser Chrome
✔ Browser application bundle generation complete.

./projects/testing/src/test.ts:2:0-29 - Error: Module not found: Error: Can't resolve 'core-js/es7/reflect' in '/home/dhalcojor/dev/ngx-translate-plugins/projects/testing/src'

20 09 2021 13:22:01.815:INFO [Chrome 93.0.4577.82 (Linux x86_64)]: Connected on socket C-QCDt6QKhPBHHKzAAAA with id 23557703
20 09 2021 13:22:01.868:WARN [web-server]: 404: /_karma_webpack_/main.js
Chrome 93.0.4577.82 (Linux x86_64): Executed 0 of 0 SUCCESS (0.02 secs / 0 secs)
TOTAL: 0 SUCCESS
TOTAL: 0 SUCCESS
dhAlcojor commented 2 years ago

Apparently, if you use yarn instead of npm, yarn run test:app works. Yet, yarn run test:lib still doesn't.

I think you shouldn't suggest in the README.md file that users run npm commands. This repo uses yarn and there's a yarn.lock, it's discouraged to use both npm and yarn in the same repo, it can cause problems. I would remove the suggestions about using npm.

mwootendev commented 2 years ago

@dhAlcojor Thanks for the notice. I pushed a fix up that should hopefully resolve it. It appears the path to the relect module in core-js changed slightly. I updated the path and ran the tests with both yarn and npm.