Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qunit-migrate

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qunit-migrate

Migrate old QUnit code to 2.x

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
increased by1000%
Maintainers
1
Weekly downloads
 
Created
Source

QUnit Migrate Build Status

Migrate old QUnit code to 2.x

Install

npm install --global qunit-migrate

Usage

$ qunit-migrate "file1, file2, file3" -d "lib/qunit" -q -w

-w: If you want to write the output to file, default: false

-d: If you want definitions support, this will try to add QUnit deps to AMD definitions and anonymous requires. You can also pass your custom dep instead of qunit like in the example case we are passing lib/qunit. So dep will be added as lib/qunit instead of qunit in requires. Keep in mind, qunit-migrate currently doesn't check if qunit definition is already present or not.

-q: If you want double quoutes support, by default we convert to single quotes

Example:

qunit-migrate tries to change old QUnit code to new QUnit specifications.

For e.g. following code will be converted as follows:

// Taken directly from jquery-globalize
// file1.js
define([
	"cldr",
	"src/core",
	"json!cldr-data/supplemental/likelySubtags.json",
	"cldr/event"
], function( Cldr, Globalize, likelySubtags ) {
Cldr.load( likelySubtags );
module( "Globalize.locale" );
test( "should allow String locale", function() {
	Globalize.locale( "en" );
	ok( Globalize.cldr instanceof Cldr );
	equal( Globalize.cldr.locale, "en" );
});
});

$ qunit-migrate "file1" -d "lib/qunit" -q -w

to

// Taken directly from jquery-globalize
// file1.js
define( [ "lib/qunit",
	"cldr",
	"src/core",
	"json!cldr-data/supplemental/likelySubtags.json",
	"cldr/event"
], function( QUnit, Cldr, Globalize, likelySubtags ) {
Cldr.load( likelySubtags );
QUnit.module( "Globalize.locale" );
QUnit.test( "should allow String locale", function( assert ) {
	Globalize.locale( "en" );
	assert.ok( Globalize.cldr instanceof Cldr );
	assert.equal( Globalize.cldr.locale, "en" );
});
});

API

$ npm install --save qunit-migrate

var qunitMigrate = require('qunit-migrate');
var data = 'Some old qunit code';
var options = {
	quotes: '"', // Kind of quotes you want
	definitions: true // or you can pass your custom definition
};
var modifiedData = qunitMigrate(data, options); // Fixed code

License

MIT © Amanpreet Singh

Keywords

FAQs

Package last updated on 05 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc