mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
test: testsuite refactoring
This commit is contained in:
parent
ea3db5f180
commit
19d2e9f9d4
50
Gruntfile.js
50
Gruntfile.js
|
@ -111,8 +111,8 @@ module.exports = function (grunt) {
|
||||||
},
|
},
|
||||||
|
|
||||||
simplemocha: {
|
simplemocha: {
|
||||||
node: {
|
functional: {
|
||||||
src: 'test/node/**/*.js',
|
src: 'test/functional/**/*.js',
|
||||||
options: {
|
options: {
|
||||||
globals: ['should'],
|
globals: ['should'],
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
|
@ -120,39 +120,12 @@ module.exports = function (grunt) {
|
||||||
reporter: 'spec'
|
reporter: 'spec'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
karlcow: {
|
unit: {
|
||||||
src: 'test/node/testsuite.karlcow.js',
|
src: 'test/unit/**/*.js',
|
||||||
options: {
|
options: {
|
||||||
globals: ['should'],
|
globals: ['should'],
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
ignoreLeaks: false,
|
ignoreLeaks: true,
|
||||||
reporter: 'spec'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
issues: {
|
|
||||||
src: 'test/node/testsuite.issues.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,
|
|
||||||
reporter: 'spec'
|
reporter: 'spec'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -204,7 +177,7 @@ module.exports = function (grunt) {
|
||||||
*/
|
*/
|
||||||
grunt.registerTask('performancejs', function () {
|
grunt.registerTask('performancejs', function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
var perf = require('./test/node/performance.js');
|
var perf = require('./test/performance/performance.js');
|
||||||
perf.runTests();
|
perf.runTests();
|
||||||
perf.generateLogs();
|
perf.generateLogs();
|
||||||
});
|
});
|
||||||
|
@ -227,16 +200,13 @@ module.exports = function (grunt) {
|
||||||
grunt.task.run(['lint', 'concat:test', 'simplemocha:single', 'clean']);
|
grunt.task.run(['lint', 'concat:test', 'simplemocha:single', 'clean']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test in Legacy Node
|
* Tasks
|
||||||
*/
|
*/
|
||||||
grunt.registerTask('test-old', ['concat:test', 'simplemocha:node', 'clean']);
|
|
||||||
|
|
||||||
/**
|
grunt.registerTask('test', ['clean', 'lint', 'concat:test', 'simplemocha:unit', 'simplemocha:functional', 'clean']);
|
||||||
* Tasks for new node versions
|
grunt.registerTask('test-functional', ['concat:test', 'simplemocha:functional', 'clean']);
|
||||||
*/
|
grunt.registerTask('test-unit', ['concat:test', 'simplemocha:unit', 'clean']);
|
||||||
grunt.registerTask('test', ['clean', 'lint', 'concat:test', 'simplemocha:node', 'clean']);
|
|
||||||
grunt.registerTask('performance', ['concat:test', 'performancejs', 'clean']);
|
grunt.registerTask('performance', ['concat:test', 'performancejs', 'clean']);
|
||||||
grunt.registerTask('build', ['test', 'concat:dist', 'uglify', 'endline']);
|
grunt.registerTask('build', ['test', 'concat:dist', 'uglify', 'endline']);
|
||||||
grunt.registerTask('prep-release', ['build', 'generate-changelog']);
|
grunt.registerTask('prep-release', ['build', 'generate-changelog']);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "showdown",
|
"name": "showdown",
|
||||||
"version": "1.8.5",
|
"version": "2.0.0-alpha1",
|
||||||
"description": "A Markdown to HTML converter written in Javascript",
|
"description": "A Markdown to HTML converter written in Javascript",
|
||||||
"author": "Estevão Santos",
|
"author": "Estevão Santos",
|
||||||
"homepage": "http://showdownjs.com/",
|
"homepage": "http://showdownjs.com/",
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,47 @@
|
||||||
# Performance Tests for showdown
|
# 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)
|
## [version 1.9.0](https://github.com/showdownjs/showdown/tree/1.9.0)
|
||||||
|
|
||||||
### Test Suite: Basic (50 cycles)
|
### Test Suite: Basic (50 cycles)
|
||||||
|
|
|
@ -243,7 +243,7 @@ showdown.Converter = function (converterOptions) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a markdown string into HTML
|
* Converts a markdown string into HTML string
|
||||||
* @param {string} text
|
* @param {string} text
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
|
@ -343,6 +343,11 @@ showdown.Converter = function (converterOptions) {
|
||||||
return text;
|
return text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an HTML string into a markdown string
|
||||||
|
* @param src
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
this.makeMarkdown = function (src) {
|
this.makeMarkdown = function (src) {
|
||||||
|
|
||||||
// replace \r\n with \n
|
// replace \r\n with \n
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user