Skip to content

Commit

Permalink
test: testsuite refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
tivie committed Dec 22, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ea3db5f commit 19d2e9f
Showing 649 changed files with 464 additions and 464 deletions.
50 changes: 10 additions & 40 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -111,48 +111,21 @@ module.exports = function (grunt) {
},

simplemocha: {
node: {
src: 'test/node/**/*.js',
functional: {
src: 'test/functional/**/*.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: true,
reporter: 'spec'
}
},
karlcow: {
src: 'test/node/testsuite.karlcow.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
reporter: 'spec'
}
},
issues: {
src: 'test/node/testsuite.issues.js',
unit: {
src: 'test/unit/**/*.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
reporter: 'spec'
}
},
standard: {
src: 'test/node/testsuite.standard.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
reporter: 'spec'
}
},
features: {
src: 'test/node/testsuite.features.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
ignoreLeaks: true,
reporter: 'spec'
}
},
@@ -204,7 +177,7 @@ module.exports = function (grunt) {
*/
grunt.registerTask('performancejs', function () {
'use strict';
var perf = require('./test/node/performance.js');
var perf = require('./test/performance/performance.js');
perf.runTests();
perf.generateLogs();
});
@@ -227,16 +200,13 @@ module.exports = function (grunt) {
grunt.task.run(['lint', 'concat:test', 'simplemocha:single', 'clean']);
});


/**
* Test in Legacy Node
* Tasks
*/
grunt.registerTask('test-old', ['concat:test', 'simplemocha:node', 'clean']);

/**
* Tasks for new node versions
*/
grunt.registerTask('test', ['clean', 'lint', 'concat:test', 'simplemocha:node', 'clean']);
grunt.registerTask('test', ['clean', 'lint', 'concat:test', 'simplemocha:unit', 'simplemocha:functional', 'clean']);
grunt.registerTask('test-functional', ['concat:test', 'simplemocha:functional', 'clean']);
grunt.registerTask('test-unit', ['concat:test', 'simplemocha:unit', 'clean']);
grunt.registerTask('performance', ['concat:test', 'performancejs', 'clean']);
grunt.registerTask('build', ['test', 'concat:dist', 'uglify', 'endline']);
grunt.registerTask('prep-release', ['build', 'generate-changelog']);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "showdown",
"version": "1.8.5",
"version": "2.0.0-alpha1",
"description": "A Markdown to HTML converter written in Javascript",
"author": "Estevão Santos",
"homepage": "http://showdownjs.com/",
2 changes: 1 addition & 1 deletion performance.json

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions performance.log.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,47 @@
# Performance Tests for showdown


## [version 2.0.0-alpha1](https://github.com/showdownjs/showdown/tree/2.0.0-alpha1)

### Test Suite: Basic (50 cycles)
| test | avgTime | max | min |
|:-----|--------:|----:|----:|
|Simple "Hello World"|0.330|9.462|0.086|
|performance.testfile.md|32.210|56.635|27.395|

### Test Suite: subParsers (20 cycles)
| test | avgTime | max | min |
|:-----|--------:|----:|----:|
|hashHTMLBlocks|4.055|7.506|2.413|
|anchors|0.342|0.600|0.286|
|autoLinks|0.091|0.193|0.070|
|blockQuotes|2.896|5.991|1.987|
|codeBlocks|0.303|1.578|0.190|
|codeSpans|0.285|0.533|0.237|
|detab|0.136|0.873|0.086|
|encodeAmpsAndAngles|0.104|0.166|0.097|
|encodeBackslashEscapes|0.081|0.141|0.068|
|encodeCode|0.942|1.342|0.850|
|escapeSpecialCharsWithinTagAttributes|0.212|0.436|0.159|
|githubCodeBlocks|0.176|0.305|0.143|
|hashBlock|0.047|0.094|0.036|
|hashElement|0.003|0.046|0.001|
|hashHTMLSpans|4.276|5.772|3.965|
|hashPreCodeTags|0.144|0.324|0.110|
|headers|1.418|4.438|1.062|
|horizontalRule|0.227|0.403|0.195|
|images|0.175|0.435|0.129|
|italicsAndBold|0.375|2.407|0.228|
|lists|2.918|3.716|2.526|
|outdent|0.164|0.270|0.138|
|paragraphs|6.444|8.106|5.759|
|spanGamut|4.294|6.106|3.842|
|strikethrough|0.005|0.090|0.000|
|stripLinkDefinitions|0.230|0.286|0.221|
|tables|0.002|0.034|0.001|
|unescapeSpecialChars|0.011|0.080|0.007|


## [version 1.9.0](https://github.com/showdownjs/showdown/tree/1.9.0)

### Test Suite: Basic (50 cycles)
7 changes: 6 additions & 1 deletion src/converter.js
Original file line number Diff line number Diff line change
@@ -243,7 +243,7 @@ showdown.Converter = function (converterOptions) {
};

/**
* Converts a markdown string into HTML
* Converts a markdown string into HTML string
* @param {string} text
* @returns {*}
*/
@@ -343,6 +343,11 @@ showdown.Converter = function (converterOptions) {
return text;
};

/**
* Converts an HTML string into a markdown string
* @param src
* @returns {string}
*/
this.makeMarkdown = function (src) {

// replace \r\n with \n
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 19d2e9f

Please sign in to comment.