move cm tests

This commit is contained in:
Tony Brix 2018-04-09 22:59:01 -05:00
parent 9b2a49f821
commit db71a7f3b5
4 changed files with 8 additions and 7 deletions

View File

@ -43,7 +43,7 @@
"test": "jasmine --config=jasmine.json", "test": "jasmine --config=jasmine.json",
"test:unit": "npm test -- test/unit/**/*-spec.js", "test:unit": "npm test -- test/unit/**/*-spec.js",
"test:specs": "npm test -- test/specs/**/*-spec.js", "test:specs": "npm test -- test/specs/**/*-spec.js",
"test:integration": "npm test -- test/integration/**/*-spec.js", "test:cm": "npm test -- test/specs/commonmark/**/*-spec.js",
"test:old": "node test", "test:old": "node test",
"test:lint": "eslint bin/marked .", "test:lint": "eslint bin/marked .",
"bench": "node test --bench", "bench": "node test --bench",

View File

@ -1,5 +1,5 @@
var marked = require('../../lib/marked.js'); var marked = require('../../../lib/marked.js');
var cmSpec = require('./commonmark.json'); var cmSpec = require('./commonmark.0.28.json');
var HtmlDiffer = require('html-differ').HtmlDiffer, var HtmlDiffer = require('html-differ').HtmlDiffer,
htmlDiffer = new HtmlDiffer(); htmlDiffer = new HtmlDiffer();
var since = require('jasmine2-custom-message'); var since = require('jasmine2-custom-message');
@ -11,13 +11,14 @@ Messenger.prototype.message = function(spec, expected, actual) {
} }
Messenger.prototype.test = function(spec, section, ignore) { Messenger.prototype.test = function(spec, section, ignore) {
if (spec.section === section && ignore.indexOf(spec.example) < 0) { if (spec.section === section) {
it('should pass example ' + spec.example, function() { var shouldFail = ~ignore.indexOf(spec.example);
it('should ' + (shouldFail ? 'fail' : 'pass') + ' example ' + spec.example, function() {
var expected = spec.html; var expected = spec.html;
var actual = marked(spec.markdown, { headerIds: false, xhtml: true }); var actual = marked(spec.markdown, { headerIds: false, xhtml: true });
since(messenger.message(spec, expected, actual)).expect( since(messenger.message(spec, expected, actual)).expect(
htmlDiffer.isEqual(expected, actual) htmlDiffer.isEqual(expected, actual)
).toEqual(true); ).toEqual(!shouldFail);
}); });
} }
} }

View File

@ -1,4 +1,4 @@
var specTests = require('../'); var specTests = require('../../');
it('should run spec tests', function () { it('should run spec tests', function () {
// hide output // hide output