Angular CLI: 1.6.1
Node: 8.2.1
OS: win32 x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router
@angular/cdk: 2.0.0-beta.8
@angular/cli: 1.6.1
@angular/language-service: 4.3.2
@angular/material: 2.0.0-beta.8
@angular/platform-server: 5.1.1
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.1
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.8.1
Follow guide:
https://github.com/angular/angular-cli/wiki/stories-universal-rendering
I run;
npm run build:ssr && npm run serve:ssr
dist/browser and dist/server are created, server.js is created but when command:
webpack --config webpack.server.config.js --progress --colors
is executed, then i get this error:
ERROR in D:\Test\trunk-angular5-universal\e2e\app.e2e-spec.ts[tsl] ERROR in D:\Test\trunk-angular5-universal\e2e\app.e2e-spec.ts(3,1) TS2304: Cannot find name 'describe'.
ERROR in D:\Test\trunk-angular5-universal\e2e\app.e2e-spec.ts[tsl] ERROR in D:\Test\trunk-angular5-universal\e2e\app.e2e-spec.ts(6,3) TS2304: Cannot find name 'beforeEach'.
ERROR in D:\Test\trunk-angular5-universal\e2e\app.e2e-spec.ts[tsl] ERROR in D:\Test\trunk-angular5-universal\e2e\app.e2e-spec.ts(10,3) TS2304: Cannot find name 'it'.
ERROR in D:\Test\trunk-angular5-universal\e2e\app.e2e-spec.ts[tsl] ERROR in D:\Test\trunk-angular5-universal\e2e\app.e2e-spec.ts(12,5) TS2304: Cannot find name 'expect'.
No error
My package.json:
{
  "name": "XXX",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server",
    "serve:ssr": "node dist/server.js",
    "build:client-and-server-bundles": "ng build --prod && ng build --prod --app 1 --output-hashing=false",
    "webpack:server": "webpack --config webpack.server.config.js --progress --colors"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "1.0.0-beta.2",
    "@agm/js-marker-clusterer": "1.0.0-beta.1",
    "@angular/animations": "5.0.0",
    "@angular/cdk": "2.0.0-beta.8",
    "@angular/common": "5.0.0",
    "@angular/compiler": "5.0.0",
    "@angular/core": "5.0.0",
    "@angular/forms": "5.0.0",
    "@angular/http": "5.0.0",
    "@angular/material": "2.0.0-beta.8",
    "@angular/platform-browser": "5.0.0",
    "@angular/platform-browser-dynamic": "5.0.0",
    "@angular/platform-server": "5.1.1",
    "@angular/router": "5.0.0",
    "@covalent/core": "1.0.0-beta.5-1",
    "@nguniversal/module-map-ngfactory-loader": "5.0.0-beta.5",
    "@satispay/web-button-factory": "1.0.4",
    "@types/angular": "1.6.28",
    "@types/node": "6.0.88",
    "braintree-web": "3.22.2",
    "braintree-web-drop-in": "1.8.0",
    "classlist.js": "1.1.20150312",
    "core-js": "2.4.1",
    "enhanced-resolve": "3.3.0",
    "hammerjs": "2.0.8",
    "js-marker-clusterer": "1.0.0",
    "lory.js": "2.3.3",
    "md5": "2.2.1",
    "moment": "2.18.1",
    "ng2-cookies": "1.0.12",
    "ng2-responsive": "0.8.4",
    "ng2-scroll-to-el": "1.0.0",
    "paypal-checkout": "4.0.133",
    "rxjs": "5.5.2",
    "sass-loader": "6.0.6",
    "ts-loader": "3.2.0",
    "web-animations-js": "2.3.1",
    "zone.js": "0.8.16"
  },
  "devDependencies": {
    "@angular/cli": "1.6.1",
    "@angular/compiler-cli": "5.0.0",
    "@angular/language-service": "4.3.2",
    "@types/jasmine": "2.5.45",
    "@types/node": "6.0.88",
    "codelyzer": "3.0.1",
    "jasmine-core": "2.6.4",
    "jasmine-spec-reporter": "4.1.1",
    "karma": "1.7.0",
    "karma-chrome-launcher": "2.1.1",
    "karma-cli": "1.0.1",
    "karma-coverage-istanbul-reporter": "1.3.0",
    "karma-jasmine": "1.1.0",
    "karma-jasmine-html-reporter": "0.2.2",
    "ngx-swiper-wrapper": "5.1.0",
    "protractor": "5.1.2",
    "ts-node": "3.0.6",
    "tslint": "5.3.2",
    "typescript": "2.4.2",
    "webpack": "3.8.1"
  }
}
Could you provide a reproduction git repo we could clone? Seems like your tsconfig might be missing types.
Hi Hans
This is my tsconfig:
{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "types": [ "node" ],
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }
}
For git repo, I should publish my entire production project...
Is my tsconfig enough for the moment?
thanks
is there any other info I can give to you, maybe other configuration files or similar?
thanks
import {} from 'jasmine';
add above line to testing file 'xx.spec.ts' this will save you time..
Hi webdoors
Can you explain that please?
Don't understand where I have to add that import. Thanks
import {} from 'jasmine';
in the test file, like what you are trying to test, like appComponent.spec.ts
Thanks Webdoors. This fixed the problem. I put it in file app.e2e-spec.ts
Now I get another error, the same of the one described here:
https://github.com/angular/angular-cli/issues/8956
@Webdoors
Thanks.
I fixed this problem. your idea is really good.
Can I solve this problem with other configuration files?
such as *.json
for typescript > 2 just do a npm install --save-dev @types/jasmine
Then in the tsconfig have a 
  "typeRoots": [
      "node_modules/@types"
    ],
                    Is there a more proper solution to this other than the import {} from 'jasmine' work-around?  I'm having these same issues with an angular project which was previously working fine, but now displays the above errors when running ng serve
I have documented my issue on Stack Overflow
@strommj I don't know if this helps you but I encountered the same problem (typescript service claims there is no 'describe', 'beforeeach' etc even after I checked the @types). ng test was also not locating or executing any tests in my projects. After upgrading my local angular/cli (6.1.5) and global angular/cli (6.2.8) to latest (7.1.4), the errors disappear. Not entirely sure what is happening, but I think the versions can cause confusions.
I installed an older version of jasmine with this command:
 npm install --save-dev @types/[email protected]
and the problem solved.
@meysamsahragard, in my case I re-installed @types/[email protected] (the version that I already had) and re-started to work. I had tried clearing the cache before this but for some reason that wasn't enough... it was until I re-ran the install --save when finally worked.
We had the problem in two different development machines and solved the same way.
Thanks @meysamsahragard , did npm install --save-dev @types/[email protected] and it worked
Hi @GeoffMahugu. I'm glad that your problem has been resolved.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
import {} from 'jasmine';
add above line to testing file 'xx.spec.ts' this will save you time..