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

[Mac OSX only] You need to include some adapter that implements __karma__.start method! #3198

Closed
oliviertassinari opened this issue Nov 1, 2018 · 9 comments · Fixed by #3252 or karronoli/redpen#10

Comments

@oliviertassinari
Copy link

oliviertassinari commented Nov 1, 2018

Expected behaviour

No error

Actual behaviour

Chrome 45.0.2454 (Mac OS X 10.12.6): Executed 1684 of 1684 SUCCESS (8.972 secs / 6.907 secs)
Firefox 52.0.0 (Windows 10 0.0.0): Executed 1684 of 1684 SUCCESS (22.894 secs / 16.112 secs)
Edge 15.15063.0 (Windows 10 0.0.0): Executed 1684 of 1684 SUCCESS (10.738 secs / 8.049 secs)
HeadlessChrome 0.0.0 (Linux 0.0.0): Executed 1684 of 1684 SUCCESS (3.937 secs / 3.185 secs)
Safari 10.1.2 (Mac OS X 10.12.6) ERROR
  {
    "message": "You need to include some adapter that implements __karma__.start method!",
    "str": "You need to include some adapter that implements __karma__.start method!"
  }

https://circleci.com/gh/mui-org/material-ui/53690?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

Environment Details

Steps to reproduce the behaviour

  1. Fork the Material-UI repository on Github
  2. Clone your fork to your local machine git clone git@github.com:<yourname>/material-ui.git
  3. yarn
  4. BROWSERSTACK_USERNAME=x BROWSERSTACK_ACCESS_KEY=y yarn test:karma
@johnjbarton johnjbarton changed the title You need to include some adapter that implements __karma__.start method! [Mac OSX only] You need to include some adapter that implements __karma__.start method! Nov 1, 2018
@johnjbarton
Copy link
Contributor

The karma context code is not being loaded or fails to execute once loaded. The config points to karma-mocha.

Try:

  1. Run with --logLevel=DEBUG and safari only. Look in the log for 404 or other errors.
  2. Run with --no-single-run then open safari and look in the devtools for errors. Debug to find the reason the start method cannot be called.

@oliviertassinari
Copy link
Author

@johnjbarton Thanks, I'm investigating.

@oliviertassinari
Copy link
Author

oliviertassinari commented Nov 1, 2018

01 11 2018 16:49:24.528:DEBUG [web-server]: serving (cached): /Users/oliviertassinari/material-ui-next/node_modules/karma/static/client.html
01 11 2018 16:49:24.661:DEBUG [web-server]: serving (cached): /Users/oliviertassinari/material-ui-next/node_modules/karma/static/karma.js
01 11 2018 16:49:24.888:DEBUG [karma-server]: A browser has connected on socket Lh6lTN16ob9DAH7YAAAP
01 11 2018 16:49:24.979:INFO [Safari 10.1.2 (Mac OS X 10.12.6)]: Connected on socket Lh6lTN16ob9DAH7YAAAP with id 2911247
01 11 2018 16:49:24.979:DEBUG [launcher]: Safari 10.1 (OS X Sierra) on BrowserStack (id 2911247) captured in 760.316 secs
01 11 2018 16:49:24.980:DEBUG [karma]: All browsers are ready, executing
01 11 2018 16:49:24.980:DEBUG [karma]: Captured 1 browsers
01 11 2018 16:49:25.175:DEBUG [middleware:karma]: custom files null null null
01 11 2018 16:49:25.175:DEBUG [middleware:karma]: Serving static request /context.html
01 11 2018 16:49:25.175:DEBUG [web-server]: serving (cached): /Users/oliviertassinari/material-ui-next/node_modules/karma/static/context.html
01 11 2018 16:49:25.180:DEBUG [web-server]: upgrade /socket.io/?EIO=3&transport=websocket&sid=Lh6lTN16ob9DAH7YAAAP
01 11 2018 16:49:25.308:DEBUG [web-server]: serving (cached): /Users/oliviertassinari/material-ui-next/node_modules/karma/static/context.js
Safari 10.1.2 (Mac OS X 10.12.6) ERROR
  {
    "message": "You need to include some adapter that implements __karma__.start method!",
    "str": "You need to include some adapter that implements __karma__.start method!"
  }
Safari 10.1.2 (Mac OS X 10.12.6): Executed 0 of 1684 ERROR (0.154 secs / 0 secs)

And not error in the console
capture d ecran 2018-11-01 a 16 50 14

@johnjbarton
Copy link
Contributor

With the same setup, in the devtools for Safari, look at the context.html file. Look at the script tags added to the template: https://github.com/karma-runner/karma/blob/master/static/context.html#L27

Look for the script tag that loads karma-mocha.

@mgol
Copy link
Contributor

mgol commented Nov 2, 2018

I see the same problem with this exact version of Safari when I try to update Karma in Sizzle: https://travis-ci.org/jquery/sizzle/builds/449780589 (code from https://github.com/mgol/sizzle/tree/updates). This project uses karma-qunit.

I've tried to look at context.html in the Network pane but it disappears too quickly and there's no "Preserve log" option in DevTools.

@avhetman
Copy link

avhetman commented Dec 3, 2018

+1, also having this issue in our project after upating all of the dependencies. Browserstack can run IE, FF, Chrome, and Edge, but throws that same You need to include some adapter message for Safari 10.1.2

@JakeChampion
Copy link
Contributor

JakeChampion commented Dec 11, 2018

Hi, this issue is because safari 10 supports type=module scripts but does not support the nomodule attribute and so it runs both scripts.

<script type="module">
window.__karma__.loaded();
</script>
<script nomodule>
window.__karma__.loaded();
</script>

CanIUse footnotes 4 and 5 --> https://caniuse.com/#feat=es6-module

@mgol
Copy link
Contributor

mgol commented Dec 11, 2018

@JakeChampion An interesting finding! Could the inline code be modified to check whether the other one hasn't already been executed and then skip its second window.__karma__.loaded() invocation?

@JakeChampion
Copy link
Contributor

Yes :-)

curquhart pushed a commit to curquhart/karma that referenced this issue Jan 16, 2019
Safari 10 supports type=module but ignores nomodule which causes loaded() to execute twice.

Fixes karma-runner#3198
curquhart pushed a commit to curquhart/karma that referenced this issue Jan 16, 2019
Safari 10 supports type=module but ignores nomodule which causes loaded() to execute twice.

Fixes karma-runner#3198
johnjbarton pushed a commit that referenced this issue Jan 18, 2019
Safari 10 supports type=module but ignores nomodule which causes loaded() to execute twice.

Fixes #3198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants