ng test fails in angular universal Error "Incomplete: No specs found, , randomized with seed 48751"

sunera pathan picture sunera pathan · Sep 17, 2019 · Viewed 7.6k times · Source

convert angular 7 project into angular universal while running "ng test" command giving error as "Incomplete: No specs found, , randomized with seed 48751". Tried different ways mention over stackoverflow but nothing work for me.

ERROR in ./src/polyfills.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: ../src/polyfills.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (../node_modules/@ngtools/webpack/src/packages/ngtools/webpack/src/angular_compiler_plugin.ts:1024:15)
    at plugin.done.then (../node_modules/@ngtools/webpack/src/packages/ngtools/webpack/src/loader.ts:49:29)
    at process._tickCallback (internal/process/next_tick.js:68:7)
 @ multi ./src/polyfills.ts ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js polyfills[0]

Expected output to be ng test command run properly without giving any issue so that my unit test-cases gonna execute.

Answer

sunera pathan picture sunera pathan · Sep 17, 2019

Finally after lot of experiments got the solution. just add

`"include": [
    "**/*.spec.ts",
    "**/*.d.ts",
    "**/*.ts"
  ]`

in "tsconfig.spec.json" Hope this helpful :)