tkellen / requirejs-library-skeleton Goto Github PK
View Code? Open in Web Editor NEWRequireJS / Jasmine / r.js / almond skeleton for javascript libraries and modules.
License: MIT License
RequireJS / Jasmine / r.js / almond skeleton for javascript libraries and modules.
License: MIT License
I'm getting an error running the build:
$ node vendor/r.js -o build.js
Error: Missing either a "name", "include" or "modules" option
at Function.build.createConfig (c:\Users\dcarte10\Dev\Libraries\requirejs-library-skeleton\vendor\r.js:14901:19)
Any ideas why this is happening?
fantastic project....I've been struggling trying to get coffeescript / require.js / and jasmine to work together...this seems the cleanest solution I've seen so far--Thanks for putting this together!....I am however getting a failing spec in cs.js and I'm not really sure what kicks off the coffeescript compiler....Did I miss a step somewhere?...
full error: TypeError: Property 'coffeescript' of object # is not a function
at null. (file://localhost/Users/carloman/Documents/workspace/jasmine-require-skeleton/test/spec/cs.js:8:23)
I am new to grunt and requirejs. I change build.js and add jquery to path:
paths: {
"cs": "../vendor/cs",
"coffee-script": "../vendor/coffee-script",
"spec": "../test/spec",
"jquery": "../vendor/jquery"
},
add jquery.js to vendor/jquery.js
change lib/skeleton.js to
define(['require', 'jquery'], function (require, $) {
However, I got this following error when run 'grunt'.
$ grunt
Running "jasmine:all" (jasmine) task
Running specs for runner.html
<WARN> PhantomJS timed out, possibly due to an unfinished async spec. Use --force to continue. </WARN>
Aborted due to warnings.
What can I fix this to have jquery dependency?
Trying to figure out how to integrate blanket.js with this. Might be a good addition to the project. If you have any pointers, I'm all ears.
I have implemented this project for a backbone project we are working on. It took a bit of work, but it has been a great tool in getting our tests to be localized to the module and view level. We are working to get our QA team to learn and think in terms of moving some of the selenium tests into this approach.
I would like to be able to have the jasmine test report open a dom page show the rendered HTML for a given test. Since we have broken our bb app into modules that contain their own views, we (potentially) could allow our team to run the test suite and play with the tested code in the browser. Is this an approach you have seen or used?
I am looking for the right way to load dependencies e.g. jquery or backbone for inline.html and amd.html demos.
I worry about double loading of my dependencies e.g. my library and project which will use my lib both depend on backbonejs. How to manage such situations?
It is expected behavior that the current spec would run each spec test twice? There are only five actual specifc describe/it calls.
skeleton : should be accessible...OK
skeleton : should be accessible...OK
skeleton : should return a VERSION...OK
skeleton : should return a VERSION...OK
module : should have a method...OK
module : should have a method...OK
module : the method should work...OK
module : the method should work...OK
feature : should be working...OK
feature : should be working...OK
10 assertions passed in 10 specs (35ms)
Thanks for putting this together, it's a convenient reference. When building a library that requires third-party code (e.g., jquery), the temptation is to download the requirements into the vendor
directory, and load them with: define(['vendor/jquery'])
. The trouble with this is that any other module that requires simply jquery
will cause jquery to be loaded twice or referred to by two different module ids.
Alternatively, you can configure the require.js baseUrl like so:
<script>
var require = {
baseUrl: "../vendor",
paths: {
"skeleton": "../lib/skeleton",
"cs": "../vendor/cs",
"coffee-script": "../vendor/coffee-script"
}
}
</script>
so that modules (yours and third-party code) can simply: define(['jquery'])
. I'm curious if that's a good approach, and if so, if you would make this change in the test runners and the AMD demo harness?
that way users don't need to run the build locally to see how the output looks like and can just grab the files from the repository.
many users might not have node.js installed and/or don't know how to do it, so it's always a good idea to keep the deploy files on the project repository or provide a link where they can download the latest build.
Just a heads up that Jasmine is executing before the specs have finished loading. I modified runner-node to fix this with the following code:
var specs = fs.readdirSync(__dirname + '/spec').map(function(spec) {
return "" + __dirname + "/spec/" + spec;
});
requirejs(specs, function() {
jasmine.getEnv().addReporter(new jasmine_console());
jasmine.getEnv().execute();
});
If I have some time I'll submit a PR.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.