Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
Do not fork tap reporter / match regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav0 committed Oct 17, 2018
1 parent 6e2e68b commit 8b3bb98
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 216 deletions.
50 changes: 0 additions & 50 deletions lib/displayutils.js

This file was deleted.

62 changes: 0 additions & 62 deletions lib/old-tap-reporter.js

This file was deleted.

45 changes: 0 additions & 45 deletions lib/strutils.js

This file was deleted.

110 changes: 54 additions & 56 deletions node-tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
var fs = require('fs-extra');
var exec = require('child_process').exec;

var expect = require('chai').expect;
var chai = require('chai');
chai.use(require('chai-things'));
var expect = chai.expect;

var FAILING_FILE = __dirname + '/../tests/dummy/app/unused.js';

var execSync = require('child_process').execSync;

var chromeVersion = execSync('google-chrome --product-version').toString();
var browser = 'Chrome ' + chromeVersion.split('.').slice(0, 2).join('.');
var path = require('path');
var Promise = require('rsvp').Promise;

Expand All @@ -27,16 +25,16 @@ describe('ember-cli-eslint', function() {
return emberTest().then(function(result) {
expect(result.error).to.not.exist;
expect(result.stdout.match(/[^\r\n]+/g))
.to.contain(`ok 1 ${browser} - ESLint | app.js: should pass ESLint`)
.to.contain(`ok 2 ${browser} - ESLint | controllers/thing.js: should pass ESLint`)
.to.contain(`ok 3 ${browser} - ESLint | helpers/destroy-app.js: should pass ESLint`)
.to.contain(`ok 4 ${browser} - ESLint | helpers/module-for-acceptance.js: should pass ESLint`)
.to.contain(`ok 5 ${browser} - ESLint | helpers/start-app.js: should pass ESLint`)
.to.contain(`ok 6 ${browser} - ESLint | models/thing.js: should pass ESLint`)
.to.contain(`ok 7 ${browser} - ESLint | resolver.js: should pass ESLint`)
.to.contain(`ok 8 ${browser} - ESLint | router.js: should pass ESLint`)
.to.contain(`ok 9 ${browser} - ESLint | test-helper.js: should pass ESLint`)
.to.not.contain(`not ok 10 ${browser} - ESLint | unused.js: should pass ESLint`);
.to.include.something.that.matches(/ok 1 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app.js: should pass ESLint/)
.to.include.something.that.matches(/ok 2 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| controllers\/thing.js: should pass ESLint/)
.to.include.something.that.matches(/ok 3 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| helpers\/destroy-app.js: should pass ESLint/)
.to.include.something.that.matches(/ok 4 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| helpers\/module-for-acceptance.js: should pass ESLint/)
.to.include.something.that.matches(/ok 5 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| helpers\/start-app.js: should pass ESLint/)
.to.include.something.that.matches(/ok 6 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| models\/thing.js: should pass ESLint/)
.to.include.something.that.matches(/ok 7 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| resolver.js: should pass ESLint/)
.to.include.something.that.matches(/ok 8 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| router.js: should pass ESLint/)
.to.include.something.that.matches(/ok 9 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| test-helper.js: should pass ESLint/)
.to.not.include.something.that.matches(/not ok 10 Chrome [0-9]+\.[0-9]+ \[[0-9]+ ms\] - ESLint \| unused.js: should pass ESLint/);
})
});

Expand All @@ -48,16 +46,16 @@ describe('ember-cli-eslint', function() {
return emberTest({ NO_GROUPING: true }).then(function(result) {
expect(result.error).to.exist;
expect(result.stdout.match(/[^\r\n]+/g))
.to.contain(`ok 1 ${browser} - ESLint | app.js: should pass ESLint`)
.to.contain(`ok 2 ${browser} - ESLint | controllers/thing.js: should pass ESLint`)
.to.contain(`ok 3 ${browser} - ESLint | helpers/destroy-app.js: should pass ESLint`)
.to.contain(`ok 4 ${browser} - ESLint | helpers/module-for-acceptance.js: should pass ESLint`)
.to.contain(`ok 5 ${browser} - ESLint | helpers/start-app.js: should pass ESLint`)
.to.contain(`ok 6 ${browser} - ESLint | models/thing.js: should pass ESLint`)
.to.contain(`ok 7 ${browser} - ESLint | resolver.js: should pass ESLint`)
.to.contain(`ok 8 ${browser} - ESLint | router.js: should pass ESLint`)
.to.contain(`ok 9 ${browser} - ESLint | test-helper.js: should pass ESLint`)
.to.contain(`not ok 10 ${browser} - ESLint | unused.js: should pass ESLint`);
.to.include.something.that.matches(/ok 1 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app.js: should pass ESLint/)
.to.include.something.that.matches(/ok 2 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| controllers\/thing.js: should pass ESLint/)
.to.include.something.that.matches(/ok 3 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| helpers\/destroy-app.js: should pass ESLint/)
.to.include.something.that.matches(/ok 4 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| helpers\/module-for-acceptance.js: should pass ESLint/)
.to.include.something.that.matches(/ok 5 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| helpers\/start-app.js: should pass ESLint/)
.to.include.something.that.matches(/ok 6 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| models\/thing.js: should pass ESLint/)
.to.include.something.that.matches(/ok 7 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| resolver.js: should pass ESLint/)
.to.include.something.that.matches(/ok 8 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| router.js: should pass ESLint/)
.to.include.something.that.matches(/ok 9 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| test-helper.js: should pass ESLint/)
.to.include.something.that.matches(/not ok 10 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| unused.js: should pass ESLint/);
})
});

Expand All @@ -67,18 +65,18 @@ describe('ember-cli-eslint', function() {
return emberTest().then(function(result) {
expect(result.error).to.not.exist;
expect(result.stdout.match(/[^\r\n]+/g))
.to.contain(`ok 1 ${browser} - ESLint | app: app.js`)
.to.contain(`ok 2 ${browser} - ESLint | app: controllers/thing.js`)
.to.contain(`ok 3 ${browser} - ESLint | app: models/thing.js`)
.to.contain(`ok 4 ${browser} - ESLint | app: resolver.js`)
.to.contain(`ok 5 ${browser} - ESLint | app: router.js`)
.to.not.contain(`not ok 6 ${browser} - ESLint | app: unused.js`);
.to.include.something.that.matches(/ok 1 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: app.js/)
.to.include.something.that.matches(/ok 2 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: controllers\/thing.js/)
.to.include.something.that.matches(/ok 3 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: models\/thing.js/)
.to.include.something.that.matches(/ok 4 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: resolver.js/)
.to.include.something.that.matches(/ok 5 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: router.js/)
.to.not.include.something.that.matches(/not ok 6 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: unused.js/);

expect(result.stdout.match(/[^\r\n]+/g))
.to.contain(`ok 6 ${browser} - ESLint | tests: helpers/destroy-app.js`)
.to.contain(`ok 7 ${browser} - ESLint | tests: helpers/module-for-acceptance.js`)
.to.contain(`ok 8 ${browser} - ESLint | tests: helpers/start-app.js`)
.to.contain(`ok 9 ${browser} - ESLint | tests: test-helper.js`);
.to.include.something.that.matches(/ok 6 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: helpers\/destroy-app.js/)
.to.include.something.that.matches(/ok 7 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: helpers\/module-for-acceptance.js/)
.to.include.something.that.matches(/ok 8 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: helpers\/start-app.js/)
.to.include.something.that.matches(/ok 9 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: test-helper.js/);
})
});

Expand All @@ -90,18 +88,18 @@ describe('ember-cli-eslint', function() {
return emberTest().then(function(result) {
expect(result.error).to.exist;
expect(result.stdout.match(/[^\r\n]+/g))
.to.contain(`ok 1 ${browser} - ESLint | app: app.js`)
.to.contain(`ok 2 ${browser} - ESLint | app: controllers/thing.js`)
.to.contain(`ok 3 ${browser} - ESLint | app: models/thing.js`)
.to.contain(`ok 4 ${browser} - ESLint | app: resolver.js`)
.to.contain(`ok 5 ${browser} - ESLint | app: router.js`)
.to.contain(`not ok 6 ${browser} - ESLint | app: unused.js`);
.to.include.something.that.matches(/ok 1 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: app.js/)
.to.include.something.that.matches(/ok 2 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: controllers\/thing.js/)
.to.include.something.that.matches(/ok 3 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: models\/thing.js/)
.to.include.something.that.matches(/ok 4 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: resolver.js/)
.to.include.something.that.matches(/ok 5 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: router.js/)
.to.include.something.that.matches(/not ok 6 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: unused.js/);

expect(result.stdout.match(/[^\r\n]+/g))
.to.contain(`ok 7 ${browser} - ESLint | tests: helpers/destroy-app.js`)
.to.contain(`ok 8 ${browser} - ESLint | tests: helpers/module-for-acceptance.js`)
.to.contain(`ok 9 ${browser} - ESLint | tests: helpers/start-app.js`)
.to.contain(`ok 10 ${browser} - ESLint | tests: test-helper.js`);
.to.include.something.that.matches(/ok 7 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: helpers\/destroy-app.js/)
.to.include.something.that.matches(/ok 8 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: helpers\/module-for-acceptance.js/)
.to.include.something.that.matches(/ok 9 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: helpers\/start-app.js/)
.to.include.something.that.matches(/ok 10 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: test-helper.js/);
})
});

Expand All @@ -111,19 +109,19 @@ describe('ember-cli-eslint', function() {
return emberTest().then(function(result) {
expect(result.error).to.not.exist;
expect(result.stdout.match(/[^\r\n]+/g))
.to.contain(`ok 1 ${browser} - ESLint | app: app.js`)
.to.contain(`ok 2 ${browser} - ESLint | app: controllers/thing.js`)
.to.contain(`ok 3 ${browser} - ESLint | app: models/thing.js`)
.to.contain(`ok 4 ${browser} - ESLint | app: resolver.js`)
.to.contain(`ok 5 ${browser} - ESLint | app: router.js`)
.to.contain(`ok 6 ${browser} - ESLint | app: routes/thing.jsx`)
.to.not.contain(`not ok 7 ${browser} - ESLint | app: unused.js`);
.to.include.something.that.matches(/ok 1 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: app.js/)
.to.include.something.that.matches(/ok 2 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: controllers\/thing.js/)
.to.include.something.that.matches(/ok 3 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: models\/thing.js/)
.to.include.something.that.matches(/ok 4 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: resolver.js/)
.to.include.something.that.matches(/ok 5 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: router.js/)
.to.include.something.that.matches(/ok 6 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: routes\/thing.jsx/)
.to.not.include.something.that.matches(/not ok 7 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| app: unused.js/);

expect(result.stdout.match(/[^\r\n]+/g))
.to.contain(`ok 7 ${browser} - ESLint | tests: helpers/destroy-app.js`)
.to.contain(`ok 8 ${browser} - ESLint | tests: helpers/module-for-acceptance.js`)
.to.contain(`ok 9 ${browser} - ESLint | tests: helpers/start-app.js`)
.to.contain(`ok 10 ${browser} - ESLint | tests: test-helper.js`);
.to.include.something.that.matches(/ok 7 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: helpers\/destroy-app.js/)
.to.include.something.that.matches(/ok 8 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: helpers\/module-for-acceptance.js/)
.to.include.something.that.matches(/ok 9 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: helpers\/start-app.js/)
.to.include.something.that.matches(/ok 10 Chrome [0-9]+\.[0-9]+ - \[[0-9]+ ms\] - ESLint \| tests: test-helper.js/);
})
});
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"devDependencies": {
"broccoli-asset-rev": "^3.0.0",
"chai": "^4.0.2",
"chai-things": "^0.2.0",
"ember-cli": "~3.4.3",
"ember-cli-babel": "^7.1.2",
"ember-cli-blueprint-test-helpers": "^0.19.1",
Expand Down
3 changes: 0 additions & 3 deletions testem.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
var CustomReporter = require('./lib/old-tap-reporter');

module.exports = {
"test_page": "tests/index.html?hidepassed",
"disable_watching": true,
"reporter": CustomReporter,
"launch_in_ci": [
"Chrome"
],
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2548,6 +2548,11 @@ chai-files@^1.0.0, chai-files@^1.1.0:
dependencies:
assertion-error "^1.0.1"

chai-things@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/chai-things/-/chai-things-0.2.0.tgz#c55128378f9bb399e994f00052151984ed6ebe70"
integrity sha1-xVEoN4+bs5nplPAAUhUZhO1uvnA=

chai@^3.3.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
Expand Down

0 comments on commit 8b3bb98

Please sign in to comment.