Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Failing test for import of external file #1381

Closed
marcobusemann opened this issue Sep 10, 2018 · 2 comments
Closed

Failing test for import of external file #1381

marcobusemann opened this issue Sep 10, 2018 · 2 comments

Comments

@marcobusemann
Copy link
Contributor

Hello guys, today i started looking at an issue i opened a week ago. On my way to figure out the development workflow, i noticed a failing test.

npm install
npm run test

NodeJS:

fuse-box git:(master) ✗ node --version
v10.6.0

Output:

tests/dynamic_imports_test/ImportDynamicExternalFile.test.js ______________________
    Import dynamic external file →
      ✓ Should import a external javascript file with Vanilla API (browser) (167 ms)
      ✓ Should import an external javascript file with Vanilla API (server) (416 ms)
/Users/XXX/Dev/fuse-box/.fusebox/tests/1536598116370/test.js:18832
            delete data.error.message;
                        ^

TypeError: Cannot convert undefined or null to object
    at test.server.data (/Users/XXX/Dev/fuse-box/.fusebox/tests/1536598116370/test.js:18832:25)
    at ChildProcess.proc.on.m (/Users/XXX/Dev/fuse-box/.fusebox/tests/1536598116370/test.js:13336:32)
    at ChildProcess.emit (events.js:182:13)
    at emit (internal/child_process.js:811:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fuse-box@3.6.0-next.5 test: `node test.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fuse-box@3.6.0-next.5 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/XXX/.npm/_logs/2018-09-10T16_48_53_575Z-debug.log

The test that fails is "Should NOT import (catch) an external javascript file with Vanilla API (server)". A server is tested to fail on import("http://asdfasdfs.js"). Well on my network the url is valid and leads to a standard not found page of my internet provider.

In my opinion a test should be environment independent. What can we do about it?

@nchanged
Copy link
Contributor

@marcobusemann good point. We need to figure out how to much a request. Fuse test runner isn't advanced yet, I wish I had some time to make it jest like.
I am not saying it's not possible to mock, in fact I did that here

We could make something like that.

@nchanged
Copy link
Contributor

All tests are now using jest

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

No branches or pull requests

2 participants