vmware-archive / scripted

The Scripted code editor
Eclipse Public License 1.0
1.56k stars 166 forks source link

Multiple tests failing because of wrong pathnames #294

Closed ackalker closed 10 years ago

ackalker commented 10 years ago

Running npm test on clean Git clone, dev branch, I get multiple test failures related to wrong file paths. Some examples (full log available on request):

amd-resolver-test.js
✔ getAmdConfig
✔ getAmdConfig2
{ [Error: ENOENT, open '/home/miki/vcs/git/node-modules/scripted/tests/server/test-resources/requirejs-basedir/web3/scripts/requirejs/require.js']
  errno: 34,
  code: 'ENOENT',
  path: '/home/miki/vcs/git/node-modules/scripted/tests/server/test-resources/requirejs-basedir/web3/scripts/requirejs/require.js' }
✔ getAmdConfig3
✔ getAmdConfigWithPaths
✔ getAmdConfigWithPaths2
✔ getAmdConfigWithPathsAndBaseUrl
✔ likeScripted
✔ configBlockPat
{ [Error: ENOENT, open '/home/miki/vcs/git/node-modules/scripted/tests/server/test-resources/511/goats/client/lib/curl/src/curl.js']
  errno: 34,
  code: 'ENOENT',
  path: '/home/miki/vcs/git/node-modules/scripted/tests/server/test-resources/511/goats/client/lib/curl/src/curl.js' }
✔ findAmdConfIn511Project
✔ findAmdConfIn511ProjectWithRequireJs
✔ findIndirectAmdConfigInHtmlFileWithThreeScriptTags
✔ simpleRequireJsProject

Further down:

resolver-test.js
✔ resolveOne
✔ resolveList
✔ resolveSubToSiblingReference
✔ resolveInScriptsFolder
✔ resolveSubToSiblingInScriptsFolder
✔ requireCallWithBaseDir
✔ commonjsRefs
✔ sloppyMode
✔ sloppyModeMissing
✔ sloppyModeMultiple
✔ sloppyModePreferBestMatch
✔ preciseModeMissing
✔ pathAwarenessSimple
✔ pathAwarenessSimple2
✔ matchScore
✔ resolveNativeNodeModules
✔ resolveNodeModule
✔ resolveNodeModulesInParentDir
✔ resolveNodeModulesWithProblem3
✔ resolveNodeModulesWithProblems
✔ resolveDotDotReference
✔ resolveDifferentStyleRelativeDotRefs
✔ resolveDifferentStyleRelativeDotDotRefs
✔ relativeRefsInAmdModuleDotDot
✔ relativeRefsInAmdModuleDot
{ [Error: ENOENT, open '/home/miki/vcs/git/node-modules/scripted/tests/server/test-resources/511/goats/client/lib/curl/src/curl.js']
  errno: 34,
  code: 'ENOENT',
  path: '/home/miki/vcs/git/node-modules/scripted/tests/server/test-resources/511/goats/client/lib/curl/src/curl.js' }
✔ amdResolveBasedOnPackagesConfig
{ [Error: ENOENT, open '/home/miki/vcs/git/node-modules/scripted/tests/server/test-resources/511/goats/client/lib/curl/src/curl.js']
  errno: 34,
  code: 'ENOENT',
  path: '/home/miki/vcs/git/node-modules/scripted/tests/server/test-resources/511/goats/client/lib/curl/src/curl.js' }
✔ commonsJsWrappedModuleInAmdEnabledContext
✔ usePlugins
✔ voloSample
✔ subPackageImport

and finally failing with:

Creating servlet handler for function: getContents
Registering a servlet for path: /jsdepend/getContents
Creating servlet handler for function: getDependencies
Registering a servlet for path: /jsdepend/getDependencies
Creating servlet handler for function: getDGraph
Registering a servlet for path: /jsdepend/getDGraph
Creating servlet handler for function: getConf
Registering a servlet for path: /jsdepend/getConf
Creating servlet handler for function: retrieveNearestFile
Registering a servlet for path: /jsdepend/retrieveNearestFile
Registering a servlet for path: /exec
Registering a servlet for path: /filesystem/rename
Registering a servlet for path: /filesystem/deleteResource
Registering a servlet for path: /filesystem/mkdir
Registering a servlet for path: /filesystem/createFile
Registering a servlet for path: /get
Registering a servlet for path: /put
Registering a servlet for path: /fs_list
Registering a servlet for path: /templates
mongodb://localhost:27017/db
SockJS v0.3.1 bound to "/websockets"
Server port = 7261
Server has started.
http://localhost:7261/clientTests
Handling client tests
Handling test file: /tests/client/testsetup.js
Exec finished
ReferenceError: Can't find variable: QUnit

  http://localhost:7261/clientTests:12
ReferenceError: Can't find variable: QUnit

  phantomjs://webpage.evaluate():5
The `QUnit` object is not present on this page.

http://localhost:7261/clientServerTests
Handling client server tests
Handling test file: /tests/client/testsetup.js
Exec finished
ReferenceError: Can't find variable: QUnit

  http://localhost:7261/clientServerTests:12
ReferenceError: Can't find variable: QUnit

  phantomjs://webpage.evaluate():5
The `QUnit` object is not present on this page.

{ [Error: Command failed: ] killed: false, code: 1, signal: null }
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

Another thing worth mentioning: phantomjs is required to be installed globally, but not mentioned in the Wiki.

ackalker commented 10 years ago

Quick-fixing the paths to QUnit files leads to yet more errors about missing files, notably .../tests/client/components/requirejs/require.js and .../tests/client/tests/client/testsetup.js.

kdvolder commented 10 years ago

Actually those first few ones I don't think are test failures. These are errors that happen during 'normal' operation (resolving / looking for stuff scipted will look for files in several places and results in a exception that is handled when these don't exist. The exceptions are getting logged to the console which is confusing, but the tests themselves are actually passing.

The QUnit error I have seen before and that is a real failure there. It has something to do with how the client side tests are running. Unfortunately I'm not that familiar with the client-side code/tests.

Looks like you are trying to get to the bottom of that. If you manage it please let me know what changes you made to get client-side tests running again.

ackalker commented 10 years ago

Thanks for the quick reply :-) I will push the QUnit fix and add the part of the log with the resulting other errors.

EDIT: Yes, the path to qunit.js is that strange. It appears to have been fixed in newer versions.

ackalker commented 10 years ago

wow, sorry about that :-) I used hub pull-request -i <#issue>, which gave me the warning:

Warning: Issue to pull request conversion is deprecated and might not work in the future.

and then spammed this conversation with all the old commits.

ackalker commented 10 years ago

Guess I should have used git push --all ...

ackalker commented 10 years ago

With the proposed fix, all clientTests pass. The clientServerTests progress up to:

Starting to find completions in /home/miki/vcs/git/node-modules/scripted/tests/client/test-resources/completions/test4.scripted-completions
Client requested content assist templates complete
Processing get request for /home/miki/vcs/git/node-modules/scripted/tests/client/test-resources/foo.js

and then appears to hang . Killing the test runner with ^C does clean up all processes, so it isn't a freeze.

kdvolder commented 10 years ago

I pulled those changes but still getting the same error that 'QUnit' isn't defined.

kdvolder commented 10 years ago

I'm confused now. I tried to go back to older commits to find where this actually broke. The tests passing at 'Upgrade to doctrine 0.0.4'. Then I went forward one commit at a time and tried to run the tests again. Finally... all tests are passing on the current dev branch with none of your fixes in.

I don't have time right now to look into it further. I'm guessing probably something todo with bower component being in wrong/different place.

I didn't actually run bower to install all the client-side modules.

I'm guessing me and you are probably using different versions of QUnit somehow.

ackalker commented 10 years ago

Are you working from a clean clone on dev branch? I normally do:

$ git clean -dfx # make sure you've committed / backed up _all_ local changes, _including_ untracked files!!
$ git status # Be sure to be on 'dev' branch
$ git reset --hard # force everything to tip of branch (i.e. 'dev')
$ npm install
$ npm test

Also, I've noticed that npm install postinstall step appears to use the version of bower installed within scripted/node_modules/bower, which makes working with a globally-installed bower from the command line difficult. For one, newer bower now requires name property in component.json, etc., so better use the one included in scripted.

This is output on my system:

$ cd client && ../node_modules/bower/bin/bower list
bower discover Please wait while newer package versions are being discovered
/home/miki/vcs/git/node-modules/scripted/client
├── curl#0.7.3 (0.8.8 now available)
├── doctrine#0.0.4 (0.2.0 now available)
├── json5#0.1.0 (0.3.0 now available)
├── meld#1.1.0 (1.3.0 now available)
├── probes#0.1.0
├── qunit#1.10.0 (1.14.0 now available)
├── requirejs#2.1.4 (2.1.10 now available)
├── requirejs-i18n#2.0.1 (2.0.4 now available)
├── requirejs-text#2.0.4 (2.0.10 now available)
├─┬ rest#0.8.4 (1.0.0 now available)
│ └── when#1.7.1 (2.8.0 now available)
├── when#1.7.1 (2.8.0 now available)
└── wire#0.9.0 (0.10.5 now available)

Note that qunit is an old version which has qunit.js in the odd path. Please compare.

kdvolder commented 10 years ago

I've merged the PR into 'dev' branch. Github is not auto closing it because it looks like it wants to see that PR merged into master. So I'm closing it manually.

kdvolder commented 10 years ago

Although the list command you gave me shows same version of QUnit it must actually be a different one somehow.

I git cleaned and reran npm install and tests are all passing for me with your path fixes in the mix. So I merged in the pull request.

kdvolder commented 10 years ago

Build passed all tests on travis: https://travis-ci.org/scripted-editor/scripted/builds/18372736

ackalker commented 10 years ago

Congrats! :-) Thanks for merging.