- Rename
MethodChain#_()
toMethodChain#__()
to avoid clobbering Underscore in test suites
- Remove
Enumerable
class methods fromTest.Unit.TestCase
- Log all mock argument matchers that match a method call, so a test will not fail if two mocks match the same call
- Use the last matching stub expression to pick the function's response rather than the first since the last will usually be more specific
- Don't treat
null
as an error when passed to async test callbacks - Be strict about whether stubbed functions are called with
new
or not - Add
withNew()
as a stub modifier to replacestub('new', ...)
- Add
on(target)
as a stub matcher for checking thethis
binding of a call - Improve stub error messaging and argument matcher representations
- Change
AsyncSteps
so it wraps all calls tobefore()
,it()
andafter()
so that each block waits for all the steps it queues to complete
- Fix indexing bug in dynamic generation of autoload.require lists
- Turn all library components into CommonJS modules running in strict mode
- Extract
JS.Test
into its own package,jstest
, with expanded platform support - Extract
jsbuild
into its own package - Remove
callSuper
from objects when there is no super method to dispatch to - Remove the
Benchmark
module, we recommend Benchmark.js instead - Refactor
Console
to make it easier to replace platform implementations - Add cursor movement,
exit()
andenvvar()
APIs toConsole
- Allow color output to be disabled using the
NO_COLOR=1
environment variable - Support color console output in Chrome and PhantomJS
- Remote the
it()
andits()
global functions fromMethodChain
- Rename
JS.Packages
toJS.packages
(lowercasep
) and replaceJS.cacheBust = true
withJS.cache = false
- Allow package autoloaders to supply their own function for converting an object name into a path
- Make sure that errors are correctly propagated and handled in async tests
- Allow errors added to
Test.ASSERTION_ERRORS
to be treated as failures - Add pluggable test reporter API with many new built-in output formats and adapters for many browser test runners
- Correct the name of
--directory
param tojsbuild
- Ship source maps for minified JavaScript files
- Fix a bug in stubbing library that makes it easier to stub methods on prototypes
- Catch uncaught errors on Node and in the browser, so errors that happen in async code don't crash the test process
- Make
assertEqual()
work withDate()
objects
- Fix a race condition in the
AsyncSteps
scheduling code - Make
Console
stringify DOM nodes successfully in Chrome
- Allow packages to contain multiple files as a convenience for loading 3rd-party libraries
- Fix script loading on Adobe AIR
- Fix fetching of scripts over HTTPS in
jsbuild
, and fail if requests return a non-200 status - Make sure
Module
andMethod
have all theKernel
methods - Make tests raise an error if a block takes a resume-callback but doesn't call it after 10 seconds
- Change
TestSuite.forEach
so that test suites run much faster - Show stack traces for errors during tests, and use
sourceURL
mapping to improve reporting of errors from scripts loaded over XHR
- Allow
yields()
andreturns()
to be used on the same stub - Remove deprecation warnings about Node's
sys
module
- Add
JS.load()
function as shorthand method for loading files, andJS.cacheBust
setting for bypassing the browser cache - Make
jsbuild
error output nicer, e.g. don't show Node backtrace
- Allow constructors expected to be called with
new
to be mocked and stubbed inTest
- Enhance browser UI with user agent and success indicator and provide controls for running individual groups of tests
- Send entire test UI snapshot to TestSwarm rather than just a short status summary
- Fix serialization of objects containing circular references in
Console.convert()
- Improvements to
jsbuild
for managing bundles of scripts
- Exit with non-zero exit status from
Test.autorun()
if there are any test failures - Log test progress as JSON so we can pick up test results using PhantomJS
- Allow post-test reports to cause the build to fail by returning false from
report()
. e.g.Coverage
can cause a red build if it finds methods that were not called - Use synchronous
console.warn()
to produce output in Node, andSystem.out.print[ln]
on Rhino platforms
- Adds NPM package and jsbuild command-line program for bundling required modules for deployment, called jsbuild
- When using
JS.require()
, scripts from the same domain are prefetched over XHR to maximize parallel downloading - Fixes support for negative mock expectations, e.g.
expect(object, 'm').exactly(0)
- Fixes scheduling bugs in
FakeClock
so that current time remains correct when removing and restoring timers - Avoids stubbing of
setTimeout()
insideAsyncSteps
, otherwise it becomes very hard to use withFakeClock
- All components now run on a much wider array of platforms
- JS.Class is now tested using its own test framework, JS.Test
- New libraries:
Benchmark
,Console
,Deferrable
,OrderedHash
,Range
,OrderedSet
,TSort
HashSet
has become the baseSet
implementation, and the originalSet
implementation has been removedStackTrace
has been totally overhauled to support extensible user-defined tracing functionality- New core method
Module#alias()
for aliasing methods - User-defined keyword methods using
Method.keyword()
- JS.Class no longer supports subclassing the
Class
class Module#instanceMethod()
returns aMethod
, not aFunction
Enumerable#grep()
now supports selecting by type, e.g.items.grep(Array)
. It does not support functional predicates likeitems.grep(function(x) { return x == 0 })
, you should useEnumerable#select()
for this- Objects with the same properties, and Arrays with the same elements are now
considered equal when used as
Hash
keys MethodChain#fire()
is now calledMethodChain#__exec__()
JS.Ruby
has been removedJS.State
now addsstates()
as a class method, rather than a macro in the class body. All classes using 'inline' states MUST call this method to declare and resolve their states
- Adds support for Node, Narwhal and Windows Script Host to the
JS.Package
loading system - Adds an
autoload
macro to the package system for quickly configuring modules using filename conventions - Renames
require()
toJS.require()
so as not to conflict with CommonJS module API
- Rewritten the package loader to use event listeners to trigger loading of dependencies rather than polling for readiness
package.js
andloader.js
no longer depend on or include the JS.Class core; you must callrequire()
to useJS.Class
,JS.Module
,JS.Interface
orJS.Singleton
- Fix bug in browser package loader in environments that have a global
console
object with noinfo()
method
- Fixes the
load()
function in thePackages
DSL, and adds some caching to improve lookup times for finding a package by the name of its provided objects - Non-existent package errors are now defered until you
require()
an object rather than being thrown at package definition time. This meansrequire()
won't complain about being passed native objects or objects loaded by other means, as long as the required object does actually exist MethodChain
now adds instance methods fromModules
, and adds methods that were defined beforeMethodChain
was loadedState
now supportscallSuper()
to state methods imported from mixins; previously you could onlycallSuper()
to the superclass
LinkedList
was defined twice in thestdlib.js
bundle; this is now fixed (thanks @skim)
- Fixes a couple of
Set
bugs:Set#isProperSuperset
had a missing argument, and incomparable objects were being allowed intoSortedSet
collections
- New libraries:
ConstantScope
,Hash
,HashSet
- Improved package manager, supports parallel downloads in web browsers and now also works on server-side platforms (tested on SpiderMonkey, Rhino and V8). Also supports custom loader functions for integration with Google, YUI etc
Enumerable
updated with Ruby 1.9 methods, enumerators, andSymbol#to_proc
functionality when passing strings to iterators. Any object with atoFunction()
method can be used as an iterator. Search methods now useequals()
where possibleObjectMethods
module is now calledKernel
- New
Kernel
methods:tap()
,equals()
,hash()
,enumFor()
andmethods()
, and newModule
methods:instanceMethods()
andmatch()
- The double inclusion problem is now fixed, i.e. the following works in JS.Class 2.1:
A = new JS.Module();
C = new JS.Class({ include: A });
B = new JS.Module({ foo: function() { return 'B#foo' } });
A.include(B);
D = new JS.Class({ include: A });
new C().foo() // -> 'B#foo'
new D().foo() // -> 'B#foo'
- Ancestor and method lookups are cached for improved performance
- Automatic generation of
displayName
on methods for integration with the WebKit debugger - API change:
Set#classify
now returns aHash
, not anObject
- PDoc documentation for the core classes
- Fixes a bug caused by
Function#prototype
becoming a non-enumerable property in Safari 4, causing classes to inherit from themselves and leading to stack overflows
- The function returned by
object.method('callSuper')
now behaves correctly when called after the containing method has returned
- Fixes some bugs to make various
forEach()
methods more robust
- Fixes a
super()
-related bug inCommand
- Better handling of
include
andextend
directives such that these are processed before all the other methods are added. This allows mixins to override parts of the including class to affect future method definitions Module#include()
has been fixed so that overriding it produces more sane behaviour with respect to classes that delegate to a module behind the scenes to store methods
- Complete rewrite of the core, including a proper implementation of
Module
with all inheritance semantics based around this. Ruby-style multiple inheritance now works correctly, andcallSuper()
can call methods from mixins Class
andModule
are now classes, and must be created using thenew
keyword- Some backward compatibility breaks
- New method:
Object#__eigen__()
returns an object's metaclass - Performance of
super()
calls is much improved - New libraries:
Package
,Set
,SortedSet
andStackTrace
Package
provides a dependency-aware system for loading new JavaScript files on demand
- Fixes bug in
Decorator
andProxy.Virtual
caused by theklass
property being treated as a method and delegated
- Adds a DSL for defining classes in a more Ruby-like way using procedures rather than declarations (experimental)
- New libraries:
Forwardable
,State
- The
extended()
hook is now supported - The
implement
directive is no longer supported
- Adds a standard library, including
Command
,Comparable
,Decorator
,Enumerable
,LinkedList
,MethodChain
,Observable
andProxy.Virtual
- Renames
_super()
tocallSuper()
to avoid problems with PackR's private variable shrinking - Adds an
Object#wait()
method that calls aMethodChain
on the object usingsetTimeout()
- Memoizes calls to
Object#method()
so that the same function object is returned each time
- Singleton methods that call
super()
are now supported Object#is_a()
has been renamed toObject#isA()
- Classes now support
inherited()
andincluded()
hooks - Adds
Interface
class for easier duck-typing checks across several methods - New directive
implement
can be used to check that a class implements some interfaces - Singletons are now supported as class-like definitions that yield a single object
Module
has been added as a way to protect sets of methods by wrapping them in a closure- Removes the
bindMethods
class flag in favour of the more efficient and Ruby-likeOjbect#method()
. This can also be used on classes to get bound class methods - Exceptions thrown while calling super are no longer swallowed inside the framework
Class#method()
is nowClass#instanceMethod
- Fixes bug caused by multiple methods in the same call stack clobbering
_super()
- Fixes some inheritance bugs related to class methods and built-in instance methods
- Improves performance by bootstrapping JavaScript's prototypes for instance method inheritance
- Allows inheritance from non-JS.Class-based classes
- Improves performance by checking whether methods use
_super()
and only wrapping where necessary
- Initial release. Features single inheritance and
_super()