kaikcreator / angular-cli-web-worker

example on how to configure web workers in angular CLI
42 stars 14 forks source link

npm test broken #1

Open kabir opened 7 years ago

kabir commented 7 years ago

Hi,

When I try to run npm test, I get errors.

Here is some output from my local setup following the steps from your stackoverflow post:

$npm test

> overbaard@0.0.0 test /Users/kabir/sourcecontrol/overbaard-incubator/webapp
> karma start ./karma.conf.js

/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/@ngtools/webpack/src/entry_resolver.js:118
        throw new Error('Tried to find bootstrap code, but could not. Specify either '
              ^
Error: Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.
    at Object.resolveEntryModuleFromMain (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/@ngtools/webpack/src/entry_resolver.js:118:15)
    at AotPlugin._setupOptions (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/@ngtools/webpack/src/plugin.js:143:50)
    at new AotPlugin (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/@ngtools/webpack/src/plugin.js:26:14)
    at _createAotPlugin (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12)
    at Object.exports.getNonAotTestConfig (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/@angular/cli/models/webpack-configs/typescript.js:103:19)
    at WebpackTestConfig.buildConfig (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/@angular/cli/models/webpack-test-config.js:17:31)
    at init (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/@angular/cli/plugins/karma.js:79:94)
    at Array.invoke (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/di/lib/injector.js:75:15)
    at Injector.get (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/di/lib/injector.js:48:43)
    at /Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/karma/lib/server.js:143:20
    at Array.forEach (native)
    at Server._start (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/karma/lib/server.js:142:21)
    at Injector.invoke (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/di/lib/injector.js:75:15)
    at Server.start (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/karma/lib/server.js:103:18)
    at Object.exports.run (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/karma/lib/cli.js:280:26)
    at requireCliAndRun (/Users/kabir/sourcecontrol/overbaard-incubator/webapp/node_modules/karma-cli/bin/karma:44:16)
npm ERR! Test failed.  See above for more details.

I got the same problem trying to do the same with a clone of this repository as well.

I will dig into this myself (eventually!) and post back with any fix I come up with.

SergeyMell commented 6 years ago

I got the same issue. For now I have a separate module, which bootstraps the application within single thread mode and it is used for testing. Not the best way but better than nothing. @kabir did you came up with any solution?

kabir commented 6 years ago

@SergeyMell I gave up on using webworkers. My use case was displaying a huge table (a kanban board). Filtering issues etc. was very slow once you have a lot of data, but turned out to be a rendering problem. Once I trimmed the data to be passed to the rendering layer performance was good, and I did not need to use web workers.