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

Project fails to startup when naming a crud module as a plural noun that doesn't end in 's'. #234

Open
donohutcheon opened this issue Jun 26, 2016 · 4 comments

Comments

@donohutcheon
Copy link
Contributor

The bug is reproducible by following the following Youtube video MeanJS - MEAN stack Yeoman Generator Tutorial from 3:47 up to 5:54.

The problem occurs because the crud-module/templates/tests/server/_.server.routes.tests.js file refers to a variable named <%= camelizedPluralName %>GetRes on line 89 but in the function definition on line 82 the argument is named : camelizedSingularName %>sGetErr. For most English nouns this problem will go undetected, however in the case of Superheroes (and other plural nouns that don't end in 's') the test defines a function argument of SuperherosGetRes (line 82) but on line 89 refers to the correct plural variable name: SuperheroesGetRes.

The result is that the test fails and gulp does not initialise the application when executed using gulp:

$ gulp
[14:55:07] Using gulpfile ~/dev/nodejs/xmen/gulpfile.js
[14:55:07] Starting 'default'...
[14:55:07] Starting 'env:dev'...
[14:55:07] Finished 'env:dev' after 78 μs
[14:55:07] Starting 'lint'...
[14:55:07] Starting 'less'...
[14:55:08] Finished 'less' after 313 ms
[14:55:08] Starting 'sass'...
[14:55:08] Finished 'sass' after 23 ms
[14:55:08] Starting 'csslint'...
[14:55:08] Starting 'eslint'...
[14:55:08] Starting 'jshint'...
[14:55:08] Finished 'csslint' after 542 ms
modules/superheroes/tests/server/superhero.server.routes.tests.js: line 89, col 35, 'superheroesGetRes' is not defined.

1 error
[14:55:12] Finished 'eslint' after 3.86 s
[14:55:12] 'jshint' errored after 3.72 s
[14:55:12] Error in plugin 'gulp-jshint'
Message:
    JSHint failed for: modules/superheroes/tests/server/superhero.server.routes.tests.js
[14:55:12] 'default' errored after 4.22 s
[14:55:12] Error in plugin 'run-sequence(jshint)'
Message:
    jshint stream
[14:55:12] 'lint' errored after 4.22 s
[14:55:12] Error in plugin 'run-sequence(default)'
Message:
    default callback
[14:55:12] 'lint' errored after 4.22 s
[14:55:12] Error in plugin 'run-sequence(jshint)'
Message:
    jshint stream

Obviously there are other scenarios where the inflections module will fail to match the module name to the appropriate noun / plural noun, for example formulae becomes formulaes. For this specific scenario the actual template code is inconsistent and should be fixed.

@donohutcheon
Copy link
Contributor Author

I'd like to submit a patch for this bug that will correct the problem.
_.server.routes.tests.js.zip

@codydaig
Copy link
Member

@donohutcheon Can you submit a PR for it?

@donohutcheon
Copy link
Contributor Author

No problem. I'm new to GitHub but keen to help. What's the protocol? Do I need permissions to create a new branch?

@codydaig
Copy link
Member

You fork the repo, create a branch on your repo, make your changes and commit, then create a PR from your branch on your fork to the master branch of this repo as the base.

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

No branches or pull requests

2 participants