Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
qunit-migrate
Advanced tools
Migrate old QUnit code to 2.x.
npm install --global qunit-migrate
qunit-migrate -h
Usage: qunit-migrate [options] <file ...>
QUnit Migrate: A tool to migrate your files to QUnit 2.0 API
Options:
-h, --help output usage information
-V, --version output the version number
-c, --config <path> Config file for qunit-migrate
-P, --parser <regex|ast> Parser to be used for parsing, Default: ast
-w, --write Pass if parsed files should be overwritten. Default: false
-p, --preset <string> Preset rule for jscs config. Default: jquery
-j, --no-jscs Pass if jscs fix should not be applied. Default: true
Globbing is supported in files
Examples:
$ qunit-migrate "./**/*.js" -w --preset "google" -c "config.json"
$ # This will migrate all js files in subdirectories using google
$ # preset and config as config.json
Information: AST parser is more robust than regex parser
Various rules can be toggled through use of custom config which can be passed via -c
option.
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" );
ssyncTest( "should allow String locale", function() {
stop();
Globalize.locale( "en" );
ok( Globalize.cldr instanceof Cldr );
equal( Globalize.cldr.locale, "en" );
start();
});
});
$ qunit-migrate "file1.js" -w
to
// Taken directly from jquery-globalize
// file1.js
define( [
"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 ) {
var ready = assert.async();
Globalize.locale( "en" );
assert.ok( Globalize.cldr instanceof Cldr );
assert.equal( Globalize.cldr.locale, "en" );
ready();
});
});
$ npm install --save qunit-migrate
var qunitMigrate = require('qunit-migrate');
var qmAst = qunitMigrate.ast;
var qmRegex = qunitMigrate.regex;
var data = 'Some old qunit code';
var modifiedDataAST = qmAst(data); // Fixed code through AST
var modifiedDataRegex = qmRegex(data); // Fixed code through AST
Information: qunit-migrate
api doesn't fix source with jscs
QUnit migrate tries its best to upgrade your API, but there are still some limitations.
For e.g.
All these are fixable through AST. Pull requests are welcome
MIT © Amanpreet Singh
FAQs
Migrate old QUnit code to 2.x
The npm package qunit-migrate receives a total of 10 weekly downloads. As such, qunit-migrate popularity was classified as not popular.
We found that qunit-migrate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.