From db71a7f3b5ea99ca3da33c15acd20e7ce91489a6 Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Mon, 9 Apr 2018 22:59:01 -0500 Subject: [PATCH] move cm tests --- package.json | 2 +- .../commonmark/commonmark-spec.js} | 11 ++++++----- .../commonmark/commonmark.0.28.json} | 0 test/specs/{ => original}/specs-spec.js | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) rename test/{integration/marked-spec.js => specs/commonmark/commonmark-spec.js} (97%) rename test/{integration/commonmark.json => specs/commonmark/commonmark.0.28.json} (100%) rename test/specs/{ => original}/specs-spec.js (87%) diff --git a/package.json b/package.json index 02677295..9dad9147 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "test": "jasmine --config=jasmine.json", "test:unit": "npm test -- test/unit/**/*-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:lint": "eslint bin/marked .", "bench": "node test --bench", diff --git a/test/integration/marked-spec.js b/test/specs/commonmark/commonmark-spec.js similarity index 97% rename from test/integration/marked-spec.js rename to test/specs/commonmark/commonmark-spec.js index 607ecb15..24e4f467 100644 --- a/test/integration/marked-spec.js +++ b/test/specs/commonmark/commonmark-spec.js @@ -1,5 +1,5 @@ -var marked = require('../../lib/marked.js'); -var cmSpec = require('./commonmark.json'); +var marked = require('../../../lib/marked.js'); +var cmSpec = require('./commonmark.0.28.json'); var HtmlDiffer = require('html-differ').HtmlDiffer, htmlDiffer = new HtmlDiffer(); var since = require('jasmine2-custom-message'); @@ -11,13 +11,14 @@ Messenger.prototype.message = function(spec, expected, actual) { } Messenger.prototype.test = function(spec, section, ignore) { - if (spec.section === section && ignore.indexOf(spec.example) < 0) { - it('should pass example ' + spec.example, function() { + if (spec.section === section) { + var shouldFail = ~ignore.indexOf(spec.example); + it('should ' + (shouldFail ? 'fail' : 'pass') + ' example ' + spec.example, function() { var expected = spec.html; var actual = marked(spec.markdown, { headerIds: false, xhtml: true }); since(messenger.message(spec, expected, actual)).expect( htmlDiffer.isEqual(expected, actual) - ).toEqual(true); + ).toEqual(!shouldFail); }); } } diff --git a/test/integration/commonmark.json b/test/specs/commonmark/commonmark.0.28.json similarity index 100% rename from test/integration/commonmark.json rename to test/specs/commonmark/commonmark.0.28.json diff --git a/test/specs/specs-spec.js b/test/specs/original/specs-spec.js similarity index 87% rename from test/specs/specs-spec.js rename to test/specs/original/specs-spec.js index 65526c86..2610b3bb 100644 --- a/test/specs/specs-spec.js +++ b/test/specs/original/specs-spec.js @@ -1,4 +1,4 @@ -var specTests = require('../'); +var specTests = require('../../'); it('should run spec tests', function () { // hide output