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

Script files seem to be in a different order now #78

Open
parris opened this issue Apr 2, 2015 · 5 comments
Open

Script files seem to be in a different order now #78

parris opened this issue Apr 2, 2015 · 5 comments

Comments

@parris
Copy link

parris commented Apr 2, 2015

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.

@cloudchen
Copy link
Owner

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

@ryan0122
Copy link

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

@cloudchen
Copy link
Owner

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

@ryan0122
Copy link

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,

@prantlf
Copy link

prantlf commented Nov 13, 2018

@ryan0122, the loading order has changed. When #65 git fixed, by 890766c, 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...

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

No branches or pull requests

4 participants