Skip to content

Instantly share code, notes, and snippets.

@leobalter
Created May 26, 2014 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leobalter/d859ee4e81fd53dfd552 to your computer and use it in GitHub Desktop.
Save leobalter/d859ee4e81fd53dfd552 to your computer and use it in GitHub Desktop.
rocambole-method-rename script for QUnit
var rmr = require( "rocambole-method-rename" );
var methods = [
{ old: "start", next: "QUnit.start" },
{ old: "stop", next: "QUnit.stop" },
{ old: "test", next: "QUnit.test" },
{ old: "module", next: "QUnit.module" },
{ old: "asyncTest", next: "QUnit.asyncTest" },
{ old: "ok", next: "assert.ok" },
{ old: "equal", next: "assert.equal" },
{ old: "notEqual", next: "assert.notEqual" },
{ old: "deepEqual", next: "assert.deepEqual" },
{ old: "notDeepEqual", next: "assert.notDeepEqual" },
{ old: "strictEqual", next: "assert.strictEqual" },
{ old: "notStrictEqual", next: "assert.notStrictEqual" },
{ old: "propEqual", next: "assert.propEqual" },
{ old: "notPropEqual", next: "assert.notPropEqual" },
{ old: "throws", next: "assert.throws" },
{ old: "raises", next: "assert.raises" }
];
var dirs = [
"test/unit"
];
dirs.forEach(function( myDir ) {
rmr.jsFiles( myDir ).forEach(function( file ) {
var fileContents = rmr.fileContents( file );
methods.forEach(function( method ) {
fileContents = rmr( fileContents, method.old, method.next );
});
rmr.fileContents( file, fileContents );
});
});
@leobalter
Copy link
Author

also:

{ old: "expect", next: "assert.expect" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment