grunt-template-jasmine-requirejs icon indicating copy to clipboard operation
grunt-template-jasmine-requirejs copied to clipboard

Script files seem to be in a different order now

Open parris opened this issue 9 years ago • 5 comments

As of 0.2.2 the script files are being loaded up in a way that breaks our test runner. Here is our config:

module.exports = function (grunt) {
    'use strict';

    grunt.config.set('jasmine.reserved', {
        src: [
            'src/core/spec_helper.js',
            'src/core/require_config.js',
            'src/core/spec_require_config.js'
        ],
        options: {
            display: 'short',
            keepRunner: true,
            summary: true,
            specs: ['src/**/*.spec.js', 'node_modules/jasmine-jquery/lib/jasmine-jquery.js'],
            vendor: ['bower_components/sinonjs/sinon.js', 'bower_components/jasmine-sinon/lib/jasmine-sinon.js'],
            helpers: 'src/!(core)/**/spec_helper.js',
            template: require('grunt-template-jasmine-requirejs'),
            templateOptions: {
                version: '2.1.10'
            }
        }
    });

};

We reverted back to 0.2.0 and everything with our test runner was fixed. It seems like jasmine is now being included after jasmine-sinon.

parris avatar Apr 02 '15 02:04 parris

As with v0.2.2, vendor and helpers files load in respective order. Try to adjust them based on your purpose.

cloudchen avatar Apr 03 '15 02:04 cloudchen

I have the same issue. I changed the order locally but this will not work in my Jenkins build since it can't see my local change to node_modules

ryan0122 avatar Apr 10 '15 18:04 ryan0122

@ryan0122 , can you explian it in more deatil? I don't get it. @parris , does v0.2.2 work for you?

cloudchen avatar Apr 14 '15 03:04 cloudchen

In the template the vendor scripts are being loaded before the core jasmine files which results in "jasmine" being undefined when using the jasmine-jquery plugin. I can manually change the order of the scripts being loaded in the template to work locally. However in my build job in Jenkins one of the tasks is "npm install" to install all node_modules based on package.json. Therefor my local changes won't be reflected in Jenkins. Reverting to 0.2.0 where the scripts are loaded correctly fixed my issue,

ryan0122 avatar Apr 14 '15 17:04 ryan0122

@ryan0122, the loading order has changed. When #65 git fixed, by 890766c3a22bb359ca5dd6cc79343e6610b381d7, not only the require.js script was moved, but the other scripts as well:

polyfills, vendor, requirejs, jasmine, boot, helpers, src, specs, reporters

Use vendor for including scripts before requirejs and jasmine. Use helpers for including scripts after requirejs and jasmine. Sinon qualifies for the latter.

If vendor had moved after requirejs it would allow loading stuff after requirejs, but before jasmine:

polyfills, requirejs, vendor, jasmine, boot, helpers, src, specs, reporters

I admit, that there's probably no real-world use case for this...

prantlf avatar Nov 13 '18 07:11 prantlf