Skip to content
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

Racing condition for copy of constant file when transpiling client code #1830

Closed
Koslun opened this issue Apr 26, 2016 · 0 comments
Closed

Comments

@Koslun
Copy link
Member

Koslun commented Apr 26, 2016

Item Version
generator-angular-fullstack 3.6.1
Node 4.4.2
npm 3.8.7
Operating System Ubuntu 15.10
MongoDB 3.0
Item Answer
Transpiler TypeScript
Markup HTML
CSS SCSS
Router ngRoute
Build Tool Gulp
Client Tests Jasmine
DB MongoDB
Auth Y
Bootstrap Y
BootstrapUI Y
SocketIO Y

Used the above configuration but think this should apply for all Gulp and TypeScript flavors.

Using the above configuration all tests pass but running gulp serve gives you an error indicating that the appName.constant.js file is missing. Error can be observed when trying to access the served page outputting the following to the developer console:

Uncaught Error: [$injector:modulerr] Failed to instantiate module karmaProjectApp due to:
Error: [$injector:modulerr] Failed to instantiate module karmaProjectApp.auth due to:
Error: [$injector:modulerr] Failed to instantiate module karmaProjectApp.constants due to:
Error: [$injector:nomod] Module 'karmaProjectApp.constants' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.5/$injector/nomod?p0=karmaProjectApp.constants
//and much more

Underlying problem is the following:
The task copy:constant copies the constant file. This however relies on that the constant file has been created by the task constant. Where the only task that uses copy:constant is the task transpile:client, which loads task constant in parallel with copy:constant, particularly being written before in the parallel order. A racing condition is thus present where constant needs to finish faster than copy:constant can begin.

Think the constant task was either loaded faster or was somehow run ahead of the transpile:client task in some previous commit. Either way the constant task should be a dependency of task copy:constant.

Creating PR to fix shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants