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

fix(live-server): testing #1331

Merged
merged 17 commits into from
Jun 21, 2021

Conversation

mfranzke
Copy link
Contributor

@mfranzke mfranzke commented Jun 6, 2021

Summary of changes:

I've identified that the tests for the live-server subpackage tend to fail (not just partly like before, but due to bigger problems in total).

It seems to be especially about two code changes that have been introduced with commit f56ba66 that would need to get further analyzed (both executed via yarn run test:separate:

yarn run v1.22.10
$ mocha test && npm run lint
/Users/maximilianfranzke/Sites/patternlab-node-fork/packages/live-server/index.js:175
  const watchPaths = options.watch || [root, ...options.assets];
                                                        ^

TypeError: options.assets is not iterable
    at Object.LiveServer.start (/Users/maximilianfranzke/Sites/patternlab-node-fork/packages/live-server/index.js:175:57)
    at Object.<anonymous> (/Users/maximilianfranzke/Sites/patternlab-node-fork/packages/live-server/test/acceptance.js:3:32)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at /Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/mocha/lib/mocha.js:514:10)
    at Object.<anonymous> (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/mocha/bin/_mocha:484:18)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
    at internal/main/run_main_module.js:17:11
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  33) spa tests
       spa-ignore-assets should not redirect .css:
     TypeError: Cannot read property 'address' of undefined
      at Test.serverAddress (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/supertest/lib/test.js:55:18)
      at new Test (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/supertest/lib/test.js:36:12)
      at Object.obj.<computed> [as get] (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/supertest/index.js:25:14)
      at Context.<anonymous> (test/spa.js:36:40)
      at processImmediate (internal/timers.js:439:21)

Additionally I've fixed these further aspects:

  1) basic functional tests
       should not inject script into svg files:
     Error: injected code not found
      at test/acceptance.js:44:17
      at Test._assertFunction (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/supertest/lib/test.js:281:11)
      at Test.assert (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/supertest/lib/test.js:171:18)
      at assert (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/supertest/lib/test.js:131:12)
      at /Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/supertest/lib/test.js:128:5
      at Test.Request.callback (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/superagent/lib/node/index.js:716:12)
      at /Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/superagent/lib/node/index.js:916:18
      at IncomingMessage.<anonymous> (/Users/maximilianfranzke/Sites/patternlab-node-fork/node_modules/superagent/lib/node/parsers/image.js:10:5)
      at endReadableNT (_stream_readable.js:1183:12)
      at processTicksAndRejections (internal/process/task_queues.js:80:21)
  • the package got renamed with commit 420f3ea:
Uncaught AssertionError [ERR_ASSERTION]: version not found

@JosefBredereck do you have the chance to have a look whether those two changes to your previously checked in code with commit f56ba66 are fine for you?

The following code changes are mainly minor changes, but remaining to have the tests run smoothly again:

assert(stdout.indexOf('Serving') == 0, 'serving string not found');

Solutions

Retest

To retest the changes out of this release:

yarn run setup && cd packages/live-server/ && yarn run test:separate

@mfranzke mfranzke marked this pull request as draft June 7, 2021 05:26
@mfranzke mfranzke marked this pull request as ready for review June 9, 2021 20:11
@mfranzke mfranzke requested a review from JosefBredereck June 21, 2021 18:07
@JosefBredereck JosefBredereck merged commit 2b2e1b1 into pattern-lab:dev Jun 21, 2021
@mfranzke mfranzke deleted the fix-live-server-testing branch June 23, 2021 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants