Skip to content

Commit

Permalink
Fix errors when running markdown-doctest
Browse files Browse the repository at this point in the history
 - import in bin/cmd.js
 - drop lodash dependency
 - target es5 (markdown-doctest is used by a wide variety of packages,
 who run tests on all sorts of versions of nodes)
  • Loading branch information
Widdershin committed Oct 13, 2019
1 parent ebdefed commit 6a897f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/cmd.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/env node
'use strict';

var doctest = require('../lib/doctest');
var doctest = require('..');

var fs = require('fs');

Expand Down
7 changes: 5 additions & 2 deletions src/doctest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { runInNewContext } from "vm";
import { transformSync } from "@babel/core";
import presetEnv from "@babel/preset-env";
import chalk from "chalk";
import flatten from "lodash/flatten";

function flatten<T>(arr: T[][]): T[] {
return Array.prototype.concat.apply([], arr);
}

import parseCodeSnippets, {
Snippet,
Expand Down Expand Up @@ -95,7 +98,7 @@ function testFile(config: Config) {
results = codeSnippets.map(test(config, fileName));
}

return flatten(results);
return results;
};
}

Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"moduleResolution": "node",
"target": "es5",
"rootDir": "src",
"outDir": "./dist",
"allowSyntheticDefaultImports": true
Expand Down

0 comments on commit 6a897f1

Please sign in to comment.