Gathering detailed insights and metrics for grunt-template-jasmine-requirejs-preloader
Gathering detailed insights and metrics for grunt-template-jasmine-requirejs-preloader
Gathering detailed insights and metrics for grunt-template-jasmine-requirejs-preloader
Gathering detailed insights and metrics for grunt-template-jasmine-requirejs-preloader
RequireJS template for grunt-contrib-jasmine task
npm install grunt-template-jasmine-requirejs-preloader
Typescript
Module System
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
109 Commits
1 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Mar 18, 2014
Latest Version
0.0.3
Package Id
grunt-template-jasmine-requirejs-preloader@0.0.3
Size
91.14 kB
NPM Version
1.4.4
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
npm install grunt-template-jasmine-requirejs-preloader
1// Example configuration using a single requireJS config file
2grunt.initConfig({
3 connect: {
4 test : {
5 port : 8000
6 }
7 },
8 jasmine: {
9 taskName: {
10 src: 'src/**/*.js',
11 options: {
12 specs: 'spec/*Spec.js',
13 helpers: 'spec/*Helper.js',
14 keepRunner: true,
15 host: 'http://127.0.0.1:8000/',
16 template: require('grunt-template-jasmine-requirejs-preloader'),
17 templateOptions: {
18 requireConfig: requireConfig,
19 preloads: ['modulesLoader']
20 }
21 }
22 }
23 }
24});
grunt-contrib-jasmine
0.6.xThe host package of this template has been upgraded to 0.6.x, which enables Jasmine 2.0 support.
Unfortunately, there's major conflict which can't be solved by code changes.
You cannot use this template in conjunction with 0.6.x of grunt-contrib-jasmine
until the host package fixes that conflict.
We released v0.1.9 patch version with strict peerDependencies
of host package to notify version conflict.
If you meet that error message, please downgrade your grunt-contrib-jasmine
to ~0.5.3
by running below command:
npm install grunt-contrib-jasmine@0.5.3 --save-dev
npm install grunt-template-jasmine-requirejs --save-dev
Type: String
Options: 2.0.0
to 2.1.10
or path to a local file system version(relative to Gruntfile.js). Absolute path is allowed as well. Default: latest requirejs version included
The version of requirejs to use.
Type String
or Array
This can be a single path to a require config file or an array of paths to multiple require config files. The configuration is extracted from the require.config({}) call(s) in the file, and is passed into the require.config({}) call in the template.
Files are loaded from left to right (using a deep merge). This is so you can have a main config and then override specific settings in additional config files (like a test config) without having to duplicate entire requireJS configs.
If requireConfig
is also specified then it will be deep-merged onto the settings specified by this directive.
Type: Object
This object is JSON.stringify()
-ed ( support serialize Function object ) into the template and passed into var require
variable
If requireConfigFile
is specified then it will be loaded first and the settings specified by this directive will be deep-merged onto those.
1// Example configuration using a single requireJS config file
2grunt.initConfig({
3 connect: {
4 test : {
5 port : 8000
6 }
7 },
8 jasmine: {
9 taskName: {
10 src: 'src/**/*.js',
11 options: {
12 specs: 'spec/*Spec.js',
13 helpers: 'spec/*Helper.js',
14 host: 'http://127.0.0.1:8000/',
15 template: require('grunt-template-jasmine-requirejs'),
16 templateOptions: {
17 requireConfigFile: 'src/main.js'
18 }
19 }
20 }
21 }
22});
1// Example configuration using an inline requireJS config 2grunt.initConfig({ 3 connect: { 4 test : { 5 port : 8000 6 } 7 }, 8 jasmine: { 9 taskName: { 10 src: 'src/**/*.js', 11 options: { 12 specs: 'spec/*Spec.js', 13 helpers: 'spec/*Helper.js', 14 host: 'http://127.0.0.1:8000/', 15 template: require('grunt-template-jasmine-requirejs'), 16 templateOptions: { 17 requireConfig: { 18 baseUrl: 'src/', 19 paths: { 20 "jquery": "path/to/jquery" 21 }, 22 shim: { 23 'foo': { 24 deps: ['bar'], 25 exports: 'Foo', 26 init: function (bar) { 27 return this.Foo.noConflict(); 28 } 29 } 30 }, 31 deps: ['jquery'], 32 callback: function($) { 33 // do initialization stuff 34 /* 35 36 */ 37 } 38 } 39 } 40 } 41 } 42 } 43});
1// Example using a base requireJS config file and specifying 2// overrides with an inline requireConfig file. 3grunt.initConfig({ 4 connect: { 5 test : { 6 port : 8000 7 } 8 }, 9 jasmine: { 10 taskName: { 11 src: 'src/**/*.js', 12 options: { 13 specs: 'spec/*Spec.js', 14 helpers: 'spec/*Helper.js', 15 host: 'http://127.0.0.1:8000/', 16 template: require('grunt-template-jasmine-requirejs'), 17 templateOptions: { 18 requireConfigFile: 'src/main.js', 19 requireConfig: { 20 baseUrl: 'overridden/baseUrl', 21 shim: { 22 // foo will override the 'foo' shim in main.js 23 'foo': { 24 deps: ['bar'], 25 exports: 'Foo' 26 } 27 } 28 } 29 } 30 } 31 } 32 } 33});
1// Example using a multiple requireJS config files. Useful for
2// testing.
3grunt.initConfig({
4 connect: {
5 test : {
6 port : 8000
7 }
8 },
9 jasmine: {
10 taskName: {
11 src: 'src/**/*.js',
12 options: {
13 specs: 'spec/*Spec.js',
14 helpers: 'spec/*Helper.js',
15 host: 'http://127.0.0.1:8000/',
16 template: require('grunt-template-jasmine-requirejs'),
17 templateOptions: {
18 requireConfigFile: ['src/config.js', 'spec/config.js']
19 requireConfig: {
20 baseUrl: 'overridden/baseUrl'
21 }
22 }
23 }
24 }
25 }
26});
Note the usage of the 'connect' task configuration. You will need to use a task like grunt-contrib-connect if you need to test your tasks on a running server.
If you end up using this template, it's worth looking at the
source in order to familiarize yourself with how it loads your files. The load process
consists of a series of nested require
blocks, incrementally loading your source and specs:
1require([*YOUR SOURCE*], function() { 2 require([*YOUR SPECS*], function() { 3 require([*GRUNT-CONTRIB-JASMINE FILES*], function() { 4 // at this point your tests are already running. 5 } 6 } 7}
If "callback" function is defined in requireConfig, above code will be injected to the end of body of "callback" definition
1templateOptions: { 2 callback: function() { 3 // suppose we define a module here 4 define("config", { 5 "endpoint": "/path/to/endpoint" 6 }) 7 } 8}
Generated runner page with require configuration looks like:
1var require = { 2 ... 3 callback: function() { 4 // suppose we define a module here 5 define("config", { 6 "endpoint": "/path/to/endpoint" 7 }) 8 9 require([*YOUR SOURCE*], function() { 10 require([*YOUR SPECS*], function() { 11 require([*GRUNT-CONTRIB-JASMINE FILES*], function() { 12 // at this point your tests are already running. 13 } 14 } 15 } 16 } 17 ... 18}
This automation can help to avoid unexpected dependency order issue
grunt-contrib-jasmine
0.6.x, added requirejs 2.1.9 & 2.1.10No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
license file not detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More