Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing capability in TypeScript #282

Merged
merged 7 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use strict";

module.exports = {
recursive: true,
reporter: "spec",
require: 'ts-node/register',
ui: "bdd",
};
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ Or:

Failures in the linting process may fail our continuous integration builds.

### TypeScript tests

It's also possible to implement tests in TypeScript, primarily for the purpose of testing the TypeScript definitions. To run these tests, use:

npm run test:ts

Note: at this point ESLint is not ran against TypeScript tests.


Thanks again for helping out!


Expand Down
13 changes: 12 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ var eslint = require('gulp-eslint');

var files = {
src: ['./lib/**/*.js'],
test: ['./test/**/*.spec.js', './*.js']
test: ['./test/**/*.spec.js', './*.js'],
testTs: ['./test/**/*.spec.ts']
};

gulp.task('lint', function () {
Expand All @@ -27,11 +28,21 @@ gulp.task('dot', function () {

gulp.task('test', gulp.series('dot', 'lint'));

gulp.task('test:ts', function () {
return gulp.src(files.testTs, {read: false})
.pipe(mocha({reporter: 'dot', require: 'ts-node/register'}));
});

gulp.task('spec', function () {
return gulp.src(files.test, {read: false})
.pipe(mocha({reporter: 'spec'}));
});

gulp.task('spec:ts', function () {
return gulp.src(files.testTs, {read: false})
.pipe(mocha({reporter: 'spec'}));
});

gulp.task('coverage', function (done) {
gulp.src(files.src)
.pipe(istanbul())
Expand Down
Loading