Page 1 of 1

ng test doesn't work (poseidon-ng-4.0.1)

Posted: 19 Jun 2017, 04:36
by brettw
Download the posiedon template (4.0.1).
C:>npm install (OK)
C:> ng build (OK)
C:> ng test (NOK):
Image

- So, I added tsconfig.spec.json from angular quickstart cli project.

C:> ng test (NOK):
Image

Can someone please advise on configuration changes to get the testing framework going.
Thanks
Brett

Re: ng test doesn't work (poseidon-ng-4.0.1)

Posted: 19 Jun 2017, 09:38
by DarthMaul
Hi,

Right now there is no test written for templates. You added a ts.config file and I am guessing it comes with some simple tests. Those tests have some dependencies and those dependencies aren't imported on your side.

Code: Select all

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/spec",
    "module": "commonjs",
    "target": "es5",
    "baseUrl": "",
    "types": [
      "jasmine",
      "node"
    ]
  },
  "files": [
    "test.ts"
  ],
  "include": [
    "**/*.spec.ts",
    "**/*.d.ts"
  ]
}

This is PrimeNG tsconfig.spec.json file maybe it can help you.

Regards

Re: ng test doesn't work (poseidon-ng-4.0.1)

Posted: 20 Jun 2017, 01:18
by brettw
Thanks for the response. The tsconfig.spec.json you posted is exactly the same as the angular quickstart cli project, so it generates the same errors. All I want is for the project to execute a simple test, but it won't because of the errors. In fact even if I remove all tests and change Include in the tsconfig.spec.json to be empty, errors are still generated as above. I must admit I am completely new to angular world so please forgive any ignorance!! It would be nice if ng test worked out of the box for the template product. Thanks for any more advice if you have it.
Brett

Re: ng test doesn't work (poseidon-ng-4.0.1)

Posted: 28 Jun 2017, 09:06
by DarthMaul
Hi,

You need to import those files which produces errors.

For example for map

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';

Hope this will help you.

Regards