{"id":16368915,"url":"https://github.com/apsdehal/qunit-migrate","last_synced_at":"2025-03-23T02:33:48.780Z","repository":{"id":34566599,"uuid":"38512546","full_name":"apsdehal/qunit-migrate","owner":"apsdehal","description":"Migrate old QUnit tests to 2.x. Uses regex and ASTs to convert old QUnit code.","archived":false,"fork":false,"pushed_at":"2016-09-21T18:27:29.000Z","size":107,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-12T02:54:37.852Z","etag":null,"topics":["ast","migrator","qunit","regex"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apsdehal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-03T22:15:17.000Z","updated_at":"2021-06-26T18:27:27.000Z","dependencies_parsed_at":"2022-09-04T06:50:13.900Z","dependency_job_id":null,"html_url":"https://github.com/apsdehal/qunit-migrate","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apsdehal%2Fqunit-migrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apsdehal%2Fqunit-migrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apsdehal%2Fqunit-migrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apsdehal%2Fqunit-migrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apsdehal","download_url":"https://codeload.github.com/apsdehal/qunit-migrate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221842989,"owners_count":16890244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","migrator","qunit","regex"],"created_at":"2024-10-11T02:54:11.836Z","updated_at":"2024-10-28T14:47:31.188Z","avatar_url":"https://github.com/apsdehal.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QUnit Migrate \n[![NPM Version](https://img.shields.io/npm/v/qunit-migrate.svg?style=flat)](https://www.npmjs.com/package/qunit-migrate)\n[![Build Status](https://travis-ci.org/apsdehal/qunit-migrate.svg?branch=master)](https://travis-ci.org/apsdehal/qunit-migrate)\n\nMigrate old QUnit code to 2.x.\n\n## Features\n\n- JSCS support\n- Custom config support for defining rules\n- Supports conversion of Async tests\n- Support for globbing patterns\n- Both regex and ast parser supported\n\n## Install\n\n\u003e npm install --global qunit-migrate\n\n## Usage\n\n```\n  qunit-migrate -h\n\n  Usage: qunit-migrate [options] \u003cfile ...\u003e\n\n  QUnit Migrate: A tool to migrate your files to QUnit 2.0 API\n\n  Options:\n\n    -h, --help                output usage information\n    -V, --version             output the version number\n    -c, --config \u003cpath\u003e       Config file for qunit-migrate\n    -P, --parser \u003cregex|ast\u003e  Parser to be used for parsing, Default: ast\n    -w, --write               Pass if parsed files should be overwritten. Default: false\n    -p, --preset \u003cstring\u003e     Preset rule for jscs config. Default: jquery\n    -j, --no-jscs             Pass if jscs fix should not be applied. Default: true\n\n  Globbing is supported in files\n\n  Examples:\n\n    $ qunit-migrate \"./**/*.js\" -w --preset \"google\" -c \"config.json\"\n    $ # This will migrate all js files in subdirectories using google\n    $ # preset and config as config.json\n```\n\n*Information: AST parser is more robust than regex parser*\n\n\n## Configuration\n\nVarious rules can be toggled through use of custom config which can be passed via `-c` option.\n\n[Default config file](examples/default.config.json)\n\n[Sample config file](examples/sample.config.json)\n\n[Config Rules](examples/rules.md)\n\n## Example:\n\nqunit-migrate tries to change old QUnit code to new QUnit specifications.\n\nFor e.g. following code will be converted as follows:\n\n```js\n// Taken directly from jquery-globalize\n// file1.js\ndefine([\n  \"cldr\",\n  \"src/core\",\n  \"json!cldr-data/supplemental/likelySubtags.json\",\n  \"cldr/event\"\n], function( Cldr, Globalize, likelySubtags ) {\nCldr.load( likelySubtags );\nmodule( \"Globalize.locale\" );\nssyncTest( \"should allow String locale\", function() {\n  stop();\n  Globalize.locale( \"en\" );\n  ok( Globalize.cldr instanceof Cldr );\n  equal( Globalize.cldr.locale, \"en\" );\n  start();\n});\n});\n```\n\u003e $ qunit-migrate \"file1.js\" -w\n\nto\n\n```js\n// Taken directly from jquery-globalize\n// file1.js\ndefine( [ \n  \"qunit\",\n  \"cldr\",\n  \"src/core\",\n  \"json!cldr-data/supplemental/likelySubtags.json\",\n  \"cldr/event\"\n], function( QUnit, Cldr, Globalize, likelySubtags ) {\nCldr.load( likelySubtags );\nQUnit.module( \"Globalize.locale\" );\nQUnit.test( \"should allow String locale\", function( assert ) {\n  var ready = assert.async();\n  Globalize.locale( \"en\" );\n  assert.ok( Globalize.cldr instanceof Cldr );\n  assert.equal( Globalize.cldr.locale, \"en\" );\n  ready();\n});\n});\n```\n\n## API\n\u003e $ npm install --save qunit-migrate\n\n```js\nvar qunitMigrate = require('qunit-migrate');\nvar qmAst = qunitMigrate.ast;\nvar qmRegex = qunitMigrate.regex;\nvar data = 'Some old qunit code';\n\nvar modifiedDataAST = qmAst(data); // Fixed code through AST\nvar modifiedDataRegex = qmRegex(data); // Fixed code through AST\n```\n\n*Information: `qunit-migrate` api doesn't fix source with jscs*\n\n## Accuracy \u0026 Limitations\n\nQUnit migrate tries its best to upgrade your API, but there are still some limitations. \n\nFor e.g. \n- If you are encapsulating some of your logic in a function and using assertions in that, it is \nyour responsibility to pass assert into function parameters. API of qunit-migrate can also be upgraded to do this, but it doesn't support it at the moment\n- There might be issues with require definitions some time if they are not in the start and encapsulated somewhere.\n- QUnit.reset is not supported as of now\n\n*All these are fixable through AST. _Pull requests_ are welcome* \n\n## License\n\nMIT © [Amanpreet Singh](https://apsdehal.in)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapsdehal%2Fqunit-migrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapsdehal%2Fqunit-migrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapsdehal%2Fqunit-migrate/lists"}