Skip to content

Commit

Permalink
Isolate runner's logic from entry-point
Browse files Browse the repository at this point in the history
  • Loading branch information
Alhadis committed Aug 5, 2016
1 parent 04d69e3 commit fbde1ae
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
25 changes: 0 additions & 25 deletions bin/atom-mocha
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
#!/usr/local/bin/node --es_staging
"use strict";

/** Bring on a real test-runner */
const Mocha = require("mocha");
const Chai = require("chai");
Chai.should();


/** Check if an element contains one or more CSS classes */
Chai.Assertion.addMethod("class", function(classNames){
const subject = Chai.util.flag(this, "object");
const classList = subject.classList;

if(!Array.isArray(classNames))
classNames = classNames.split(/\s+/g);

for(let name of classNames){
this.assert(
classList.contains(name),
"expected classList '" + subject.className + "' to include #{exp}",
"expected classList '" + subject.className + "' not to include #{exp}",
name
);
}
});


/** Connect Atom to our test runner */
module.exports = require("../lib/main.js");
25 changes: 25 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ const fs = require("fs");
const path = require("path");


/** Bring on a real test-runner */
const Mocha = require("mocha");
const Chai = require("chai");
Chai.should();


/** Check if an element contains one or more CSS classes */
Chai.Assertion.addMethod("class", function(classNames){
const subject = Chai.util.flag(this, "object");
const classList = subject.classList;

if(!Array.isArray(classNames))
classNames = classNames.split(/\s+/g);

for(let name of classNames){
this.assert(
classList.contains(name),
"expected classList '" + subject.className + "' to include #{exp}",
"expected classList '" + subject.className + "' not to include #{exp}",
name
);
}
});


const patchReporter = require("./reporter-patch");

module.exports = function(args){
Expand Down

0 comments on commit fbde1ae

Please sign in to comment.