diff --git a/package.json b/package.json index 737f86df16..b8a4702ee0 100644 --- a/package.json +++ b/package.json @@ -38,9 +38,11 @@ "uglify-js": "^3.3.10" }, "scripts": { - "test": "npm run test:unit && npm run test:spec", - "test:unit": "jasmine --config=jasmine.json", - "test:spec": "node test", + "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:old": "node test", "test:lint": "eslint lib/marked.js test/index.js", "bench": "node test --bench", "lint": "eslint --fix lib/marked.js test/index.js", diff --git a/test/integration/marked-spec.js b/test/integration/marked-spec.js new file mode 100644 index 0000000000..6d3b9ee78c --- /dev/null +++ b/test/integration/marked-spec.js @@ -0,0 +1,5 @@ +var marked = require('../../marked.min.js'); + +it('should run the test', function () { + expect(marked('Hello World!')).toBe('

Hello World!

\n'); +}); diff --git a/test/specs/specs-spec.js b/test/specs/specs-spec.js new file mode 100644 index 0000000000..c30a8429dd --- /dev/null +++ b/test/specs/specs-spec.js @@ -0,0 +1,12 @@ +var tests = require('../'); + +it('should run spec tests', function () { + // hide output + spyOn(console, 'log'); + if (!tests.runTests({stop: true})) { + // if tests fail rerun tests and show output + console.log.and.callThrough(); + tests.runTests(); + fail(); + } +}); diff --git a/test/unit/marked-spec.js b/test/unit/marked-spec.js index f430302d4c..83f4fb57a0 100644 --- a/test/unit/marked-spec.js +++ b/test/unit/marked-spec.js @@ -1,5 +1,7 @@ var marked = require('../../lib/marked.js'); it('should run the test', function () { - expect(marked('Hello World!')).toContain('Hello World!'); + spyOn(marked, 'parse').and.callThrough(); + marked.parse('Hello World!'); + expect(marked.parse).toHaveBeenCalled(); });