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

Minor conflict in file naming conventions/ file names in " edu/series/102/50_real_parser.md" tutorial #24

Closed
DevasenaInupakutika opened this issue Dec 23, 2014 · 5 comments

Comments

@DevasenaInupakutika
Copy link
Contributor

Need clarification on few things before executing npm test command:

  1. When creating a basic package, I didn't get a default src folder inside my package directory. Is it same as lib folder where <module-name.js> resides?
  2. I have a directory called unit inside test, so the index.js file should be inside test or unit? Will the location of tests and the file name containing tests matter?
  3. It would be good to mentions the location inside the package directory where npm test command should be run after the steps in the tutorial.
  4. When I created package and followed the tutorial as it is along with the code: I get error as below:
$ sudo npm test

> [email protected] test /Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real
> gulp

[16:48:47] Using gulpfile ~/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/gulpfile.js
[16:48:47] Starting 'lint'...
[16:48:47] Starting 'test-unit'...
[16:48:47] Starting 'clean'...
[16:48:47] Finished 'clean' after 5.64 ms
[16:48:47] Starting 'init'...
[16:48:47] Finished 'init' after 144 μs
[16:48:47] Starting 'build-test'...
[16:48:47] Starting 'build-browser'...
[16:48:47] Starting 'build-browser-min'...
[16:48:47] 'test-unit' errored after 177 ms
[16:48:47] ReferenceError in plugin 'gulp-mocha'
Message:
    test is not defined
Stack:
ReferenceError: test is not defined
    at Object.<anonymous> (/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/test/unit/biojsparsereal_test.js:12:23)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at /Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/node_modules/mocha/lib/mocha.js:172:27
    at Array.forEach (native)
    at Mocha.loadFiles (/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/node_modules/mocha/lib/mocha.js:169:14)
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 9, col 29, Strings must use singlequote.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 15, col 41, Expected '===' and instead saw '=='.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 18, col 5, Missing semicolon.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 19, col 2, Missing semicolon.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 38, col 27, Expected '===' and instead saw '=='.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 38, col 51, Strings must use singlequote.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 56, col 29, Expected '===' and instead saw '=='.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 58, col 26, Expected '===' and instead saw '=='.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 58, col 60, Strings must use singlequote.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 58, col 56, Expected '!==' and instead saw '!='.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 61, col 39, Strings must use singlequote.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 61, col 62, Strings must use singlequote.
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 21, col 29, This function has too many statements. (22)
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/index.js: line 74, col 2, Missing semicolon.

And after resolving everything and even keeping all the vars in one place in the code, I get following message:

> [email protected] test /Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real
> gulp

[16:10:57] Using gulpfile ~/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/gulpfile.js
[16:10:57] Starting 'lint'...
[16:10:57] Starting 'test-unit'...
[16:10:57] Starting 'clean'...
[16:10:57] Finished 'clean' after 6.07 ms
[16:10:57] Starting 'init'...
[16:10:57] Finished 'init' after 274 μs
[16:10:57] Starting 'build-test'...
[16:10:57] Starting 'build-browser'...
[16:10:57] Starting 'build-browser-min'...
[16:10:58] 'test-unit' errored after 324 ms
[16:10:58] ReferenceError in plugin 'gulp-mocha'
Message:
    test is not defined
Stack:
ReferenceError: test is not defined
    at Object.<anonymous> (/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/test/unit/biojsparsereal_test.js:12:23)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at /Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/node_modules/mocha/lib/mocha.js:172:27
    at Array.forEach (native)
    at Mocha.loadFiles (/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/node_modules/mocha/lib/mocha.js:169:14)
/Users/user/Work/npm_biojs_practice/biojs-parse-real/biojs-parse-real/lib/biojsparsereal.js: line 16, col 29, This function has too many statements. (20)

1 error
[16:10:58] Finished 'lint' after 370 ms
[16:10:59] Finished 'build-browser-min' after 1.73 s
[16:10:59] Finished 'build-browser' after 1.75 s
[16:10:59] Finished 'build-test' after 1.91 s
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

It seems like, I placed some files in a wrong location. Could you please let me know if I am missing anything here.

And also, regarding the naming conventions, this should also be linked to issue #20 ?

@wilzbach
Copy link
Member

  1. When creating a basic package, I didn't get a default src folder inside my package directory. Is it same as lib folder where <module-name.js> resides?

Yes - see biojs/biojs#100

  1. I have a directory called unit inside test, so the index.js file should be inside test or unit? Will the location of tests and the file name containing tests matter?

Nope it is just because there can be unit test and phantom unit tests (=need a browser).
There shouldn't be the need for a index.js in the test folder (as mocha uses globa *.js), however for phantomjs tests we use a index.js, as they are moderately slow and one might to select which tests get executed.

  1. It would be good to mentions the location inside the package directory where npm test command should be run after the steps in the tutorial.

Why? NPM commands should be run in the same folder and if you are in a subfolder it will default back to the next, upper folder with a package.json. However I am happy to accept any pull request.

  1. When I created package and followed the tutorial as it is along with the code: I get error as below:
  • Never run an npm command (execpt for global installation with sudo)
  • which version of slush did you use?
  • Did you modify anything?
  • the error message states that inside your unit test a function test is called - however this function test is not defined

@wilzbach
Copy link
Member

And also, regarding the naming conventions, this should also be linked to issue #20 ?

Which naming conventions? Are you referring to src vs. lib. That is really not important - it should just be consistent over the tutorials ...

@DevasenaInupakutika
Copy link
Contributor Author

By naming conventions, I mean .js files, currently the file names are <biojs-module-name>.js instead of index.js.

Slush version: slush 1.0.1

What's the version that's recommended?

@wilzbach
Copy link
Member

wilzbach commented Jan 7, 2015

The version is slush is not really important - however the version of slush-biojs is.

AFAIK since version 0.5 of slush-biojs the created dummy file is named lib/index.js.

@wilzbach
Copy link
Member

I close this - please reopen if this is still an open issue ;-)

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