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

Run test in web browsers #300

Closed
remojansen opened this issue Jul 24, 2016 · 5 comments
Closed

Run test in web browsers #300

remojansen opened this issue Jul 24, 2016 · 5 comments

Comments

@remojansen
Copy link
Member

remojansen commented Jul 24, 2016

As reported by @endel there are some issues in some versions of IE we need to put in place some testing in real browsers to prevent this kind of issues.

At the moment we run the tests in bot windows and linux but in node.js not browser environments.

@remojansen
Copy link
Member Author

The issues in IE are caused because Function.name is not an standard in JS versions < ES6.

The good news is that function name is only used to provide developer-friendly errors and it will be fine to use the following:

function getFunctionName(f) {
    return f.name ?  f.name : f.toString().match(/^function\s*([^\s(]+)/)[1];
}

let constructorName = getFunctionName(func);

Beyond this issue we need to prevent issues in browsers and to do so we need to run the tests on a web browser.

@remojansen
Copy link
Member Author

The function.name issue was fixed #302 by but it has not been released yet.

@remojansen remojansen modified the milestones: 2.x, 2.0.0 Jul 27, 2016
@remojansen remojansen mentioned this issue Jul 31, 2016
12 tasks
@remojansen
Copy link
Member Author

remojansen commented Jul 31, 2016

Hi @endel,

Based on your feedback I have impelmented browser testing:

START:
31 07 2016 09:39:38.721:INFO [karma]: Karma v1.1.2 server started at http://localhost:9876/
31 07 2016 09:39:38.736:INFO [launcher]: Launching browsers Firefox, Chrome, IE with unlimited concurrency
31 07 2016 09:39:38.736:INFO [launcher]: Starting browser Firefox
31 07 2016 09:39:38.814:INFO [launcher]: Starting browser Chrome
31 07 2016 09:39:38.861:INFO [launcher]: Starting browser IE
31 07 2016 09:39:41.468:INFO [IE 11.0.0 (Windows 8.1 0.0.0)]: Connected on socket /#WnT7WRE6ip9Zi6wjAAAA with id 55234899
31 07 2016 09:39:42.966:INFO [Chrome 51.0.2704 (Windows 8.1 0.0.0)]: Connected on socket /#mU6ZwPr-SmIQDas4AAAB with id 13681852
31 07 2016 09:39:43.726:INFO [Firefox 47.0.0 (Windows 8.1 0.0.0)]: Connected on socket /#E4TyJvgr6NEtzvmvAAAC with id 63667869
// ...
Finished in 0.21 secs / 0.185 secs
SUMMARY:
√ 133 tests completed
× 2 tests failed
FAILED TESTS:
  InversifyJS
    × Should support the injection of providers
      IE 11.0.0 (Windows 8.1 0.0.0)
    ReferenceError: 'Promise' is undefined
       at Anonymous function (temp/bundle.test.js:10711:17)
       at Anonymous function (temp/bundle.test.js:10718:9)
    × Should be able to identify missing @injectable in a base class
      IE 11.0.0 (Windows 8.1 0.0.0)
    expected [Function: throws] to throw error including 'Missing required @injectable annotation in: Samurai' but got 'Missing required @injectable annotation in: undefined.'
    Error

It is almost ready, all the integration tests are running on the latest version of IE, Chrome and Firefox on AppVeyor.

There two test failing on IE 11 once I get those two sorted I will merge and close the issue.

There might be problems in IE < 11 but I asume that everything can be fixed using polyfills.

remojansen added a commit that referenced this issue Jul 31, 2016
* Implemented #315

* Implemented #300

* Trying to fix 'Symbol' is undefined in AppVeyor

* Trying to fix 'Promise' is undefined on IE AppVeyor

* Fix 'undefined' as class name in error msgs when base class missing @Injectable annotation

* Trying to fix symbol to string in node 0.12

* rollback

* removed node 0.12 from testing will be not supported by october 2016
@remojansen
Copy link
Member Author

Done by #316

@endel
Copy link
Contributor

endel commented Jul 31, 2016

Yay! 🎉 👏

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

No branches or pull requests

2 participants