Skip to content

Commit

Permalink
CLI: Move non-bin files from bin/ to src/cli/
Browse files Browse the repository at this point in the history
Follows-up #1271.
  • Loading branch information
Krinkle committed Dec 27, 2018
1 parent b54e732 commit 9c99d33
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions bin/qunit
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"use strict";

const program = require( "commander" );
const run = require( "./run" );
const FindReporter = require( "./find-reporter" );
const run = require( "../src/cli/run" );
const FindReporter = require( "../src/cli/find-reporter" );
const pkg = require( "../package.json" );

const findReporter = FindReporter.findReporter;
Expand Down
5 changes: 5 additions & 0 deletions src/cli/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"node": true
}
}
2 changes: 1 addition & 1 deletion bin/find-reporter.js → src/cli/find-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const JSReporters = require( "js-reporters" );
const path = require( "path" );
const findup = require( "findup-sync" );
const utils = require( "./utils" );
const pkg = require( "../package.json" );
const pkg = require( "../../package.json" );

function findReporter( reporterName ) {
if ( !reporterName ) {
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions bin/require-qunit.js → src/cli/require-qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ module.exports = function requireQUnit() {
try {

// Second, we use the globally installed QUnit
delete require.cache[ resolve.sync( "../qunit/qunit" ) ];
return require( "../qunit/qunit" );
delete require.cache[ resolve.sync( "../../qunit/qunit" ) ];
return require( "../../qunit/qunit" );
} catch ( e ) {
if ( e.code === "MODULE_NOT_FOUND" ) {

// Finally, we use the local development version of QUnit
delete require.cache[ resolve.sync( "../dist/qunit" ) ];
return require( "../dist/qunit" );
delete require.cache[ resolve.sync( "../../dist/qunit" ) ];
return require( "../../dist/qunit" );
}

throw e;
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/cli/custom-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const co = require( "co" );
const JSReporters = require( "js-reporters" );
const NPMReporter = require( "npm-reporter" );

const findReporter = require( "../../bin/find-reporter" ).findReporter;
const findReporter = require( "../../src/cli/find-reporter" ).findReporter;

const expectedOutput = require( "./fixtures/expected/tap-outputs" );
const execute = require( "./helpers/execute" );
Expand Down
8 changes: 4 additions & 4 deletions test/cli/require-qunit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ QUnit.module( "requireQUnit", function() {
const localQUnit = {
"@noCallThru": true
};
const requireQUnit = proxyquire( "../../bin/require-qunit", {
const requireQUnit = proxyquire( "../../src/require-qunit", {
"resolve": resolveStub,
"qunit": localQUnit
} );
Expand All @@ -22,7 +22,7 @@ QUnit.module( "requireQUnit", function() {
const globalQUnit = {
"@noCallThru": true
};
const requireQUnit = proxyquire( "../../bin/require-qunit", {
const requireQUnit = proxyquire( "../../src/require-qunit", {
"resolve": resolveStub,
"qunit": null,
"../qunit/qunit": globalQUnit
Expand All @@ -35,7 +35,7 @@ QUnit.module( "requireQUnit", function() {
const devQUnit = {
"@noCallThru": true
};
const requireQUnit = proxyquire( "../../bin/require-qunit", {
const requireQUnit = proxyquire( "../../src/require-qunit", {
"resolve": resolveStub,
"qunit": null,
"../qunit/qunit": null,
Expand All @@ -46,7 +46,7 @@ QUnit.module( "requireQUnit", function() {
} );

QUnit.test( "throws error if none of the modules are found", function( assert ) {
const requireQUnit = proxyquire( "../../bin/require-qunit", {
const requireQUnit = proxyquire( "../../src/require-qunit", {
"resolve": resolveStub,
"qunit": null,
"../qunit/qunit": null,
Expand Down

0 comments on commit 9c99d33

Please sign in to comment.