-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot Build loopback4 app without errors #2751
Comments
@frost-byte , you're right that you don't need to install mocha globally. I assume you accept all options when running |
@frost-byte, does the above suggestion help in getting rid of the error? Thanks. |
Closing due to inactivity. |
I am having the same issue. > office-rent-backend@1.0.0 prepare /home/snehanshu/Desktop/office-rent-backend > npm run build > office-rent-backend@1.0.0 build /home/snehanshu/Desktop/office-rent-backend > tsc src/__tests__/acceptance/home-page.acceptance.ts:5:1 - error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. 5 describe('HomePage', () => { ~~~~~~~~ src/__tests__/acceptance/home-page.acceptance.ts:9:3 - error TS2304: Cannot find name 'before'. 9 before('setupApplication', async () => { ~~~~~~ src/__tests__/acceptance/home-page.acceptance.ts:13:3 - error TS2304: Cannot find name 'after'. 13 after(async () => { ~~~~~ src/__tests__/acceptance/home-page.acceptance.ts:17:3 - error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. 17 it('exposes a default home page', async () => { ~~ src/__tests__/acceptance/home-page.acceptance.ts:24:3 - error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. 24 it('exposes self-hosted explorer', async () => { ~~ src/__tests__/acceptance/ping.controller.acceptance.ts:5:1 - error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. 5 describe('PingController', () => { ~~~~~~~~ src/__tests__/acceptance/ping.controller.acceptance.ts:9:3 - error TS2304: Cannot find name 'before'. 9 before('setupApplication', async () => { ~~~~~~ src/__tests__/acceptance/ping.controller.acceptance.ts:13:3 - error TS2304: Cannot find name 'after'. 13 after(async () => { ~~~~~ src/__tests__/acceptance/ping.controller.acceptance.ts:17:3 - error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`. 17 it('invokes GET /ping', async () => { ~~ Found 9 errors. npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! office-rent-backend@1.0.0 build: `tsc` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the office-rent-backend@1.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/snehanshu/.npm/_logs/2019-11-04T18_35_49_946Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! office-rent-backend@1.0.0 prepare: `npm run build` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the office-rent-backend@1.0.0 prepare script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/snehanshu/.npm/_logs/2019-11-04T18_35_49_961Z-debug.log |
Installing |
Description / Steps to reproduce / Feature proposal
Install LoopBack4
Run lb4 app
Enable all options (specifically tests)
Current Behavior
During the build, when the command
tsc --outDir dist --target es2017
runs,nine errors appear, all related to @types/jest, jest and @types/mocha, mocha
Expected Behavior
The build completes without any errors thrown by typescript when the tests are built.
Observations
I did not see anything in the documentation saying that I should globally install mocha, jest and the relevant type files. Installing them globally, or locally in the project directory and then running the command to build the tests then completes without throwing any errors.
Edit Installing mocha, jest and the @types for them does not fix the issue. Deleting the app and recreating it using lb4 appName still shows the same errors. The only way to fix the issues is to install them as dependencies in the project
Environment
Ubuntu 18.04.2 LTS
npm v6.7.0
nodejs 11.14.0
The text was updated successfully, but these errors were encountered: