catalyst / moodle-mod_scormremote

A Moodle activity for serving SCORM packages remotely to another LMS across domains
https://moodle.org/plugins/mod_scormremote
Other
9 stars 3 forks source link

Breaks Behat/require.js #69

Open andrewhancox opened 2 weeks ago

andrewhancox commented 2 weeks ago

Due to the JS files included not containing a define call, a couple of errors get emitted by the requirejs.php script, see around line 83: echo( "// JS module '{$modulename}' cannot be loaded, or does not contain a javascript" . ' module in AMD format. "define()" not found.' . "\n" );

The errors are as follows: // JS module 'mod_scormremote/layer3' cannot be loaded, or does not contain a javascript module in AMD format. "define()" not found. // JS module 'mod_scormremote/layer2' cannot be loaded, or does not contain a javascript module in AMD format. "define()" not found.

This seems to break requirejs loading the first time you pull in core_form/events, so the selenium server shows errors in it's logs: JavaScript error: http://moodlefourbehat.local.test/lib/javascript.php/1719486326/lib/requirejs/require.min.js, line 5: Error: Script error for "core_form/events" Which in turn stops it from running.

Was a MASSIVE pain to pin this issue down...

andrewhancox commented 2 weeks ago

It also causes errors when using the site normally, but because it always works the second time you try to load the JS files in (for some reason the built file still gets cached and is usable) it's easy to miss this.