jasmine-ts
Advanced tools
Comparing version 0.1.2 to 0.1.3
#!/usr/bin/env node | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var fs = require("fs"); | ||
var path = require("path"); | ||
require("ts-node/register"); | ||
var Jasmine = require("jasmine"); | ||
var Command = require("jasmine/lib/command"); | ||
var jasmine = new Jasmine({ projectBaseDir: path.resolve() }); | ||
var examplesDir = path.join("node_modules", "jasmine-core", "lib", "jasmine-core", "example", "node_example"); | ||
var command = new Command(path.resolve(), examplesDir, console.log); | ||
var configPath = process.env.JASMINE_CONFIG_PATH || "spec/support/jasmine.json"; | ||
var initReporters = function (config) { | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const dist_1 = require("ts-node/dist"); | ||
const yargs_1 = require("yargs"); | ||
const TS_NODE_OPTIONS = [ | ||
"fast", | ||
"lazy", | ||
"cache", | ||
"cacheDirectory", | ||
"compiler", | ||
"project", | ||
"ignore", | ||
"ignoreWarnings", | ||
"disableWarnings", | ||
"getFile", | ||
"fileExists", | ||
"compilerOptions", | ||
]; | ||
const tsNodeOptions = Object.assign({}, ...TS_NODE_OPTIONS.map((option) => yargs_1.argv[option] && { [option]: yargs_1.argv[option] })); | ||
dist_1.register(tsNodeOptions); | ||
const Jasmine = require("jasmine"); | ||
const Command = require("jasmine/lib/command"); | ||
const jasmine = new Jasmine({ projectBaseDir: path.resolve() }); | ||
const examplesDir = path.join("node_modules", "jasmine-core", "lib", "jasmine-core", "example", "node_example"); | ||
const command = new Command(path.resolve(), examplesDir, console.log); | ||
const configPath = process.env.JASMINE_CONFIG_PATH || "spec/support/jasmine.json"; | ||
const initReporters = (config) => { | ||
if (config.reporters && config.reporters.length > 0) { | ||
jasmine.env.clearReporters(); | ||
config.reporters.forEach(function (reporter) { | ||
var parts = reporter.name.split("#"); | ||
var name = parts[0]; | ||
var member = parts[1]; | ||
var reporterClass = member ? require(name)[member] : require(name); | ||
config.reporters.forEach((reporter) => { | ||
const parts = reporter.name.split("#"); | ||
const name = parts[0]; | ||
const member = parts[1]; | ||
const reporterClass = member ? require(name)[member] : require(name); | ||
jasmine.addReporter(new (reporterClass)(reporter.options)); | ||
@@ -25,3 +42,3 @@ }); | ||
}; | ||
var configJSON = ""; | ||
let configJSON = ""; | ||
try { | ||
@@ -32,3 +49,3 @@ configJSON = fs.readFileSync(path.resolve(configPath), "utf8"); | ||
if (configJSON) { | ||
var config = JSON.parse(configJSON); | ||
const config = JSON.parse(configJSON); | ||
initReporters(config); | ||
@@ -35,0 +52,0 @@ } |
{ | ||
"name": "jasmine-ts", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Execute jasmine with ts-node", | ||
@@ -31,3 +31,4 @@ "main": "lib/index.js", | ||
"ts-node": "^2.1.0", | ||
"typescript": "^2.3.2" | ||
"typescript": "^2.3.2", | ||
"yargs": "^8.0.1" | ||
}, | ||
@@ -37,5 +38,9 @@ "devDependencies": { | ||
"@types/node": "^7.0.8", | ||
"@types/yargs": "^6.6.0", | ||
"jasmine-spec-reporter": "^3.2.0", | ||
"tslint": "^4.5.1" | ||
}, | ||
"engines": { | ||
"node": ">= 5.12" | ||
} | ||
} |
@@ -21,3 +21,3 @@ # jasmine-ts | ||
"scripts": { | ||
"test": "jasmine-ts 'path/to/specs/**/*.spec.ts'" | ||
"test": "jasmine-ts \"path/to/specs/**/*.spec.ts\"" | ||
} | ||
@@ -35,3 +35,3 @@ } | ||
[jasmine-spec-reporter](https://github.com/bcaudan/jasmine-spec-reporter), | ||
you can add a reporters array to the `jasmine.json` | ||
which provides a nice output, you can add a reporters array to the `jasmine.json` | ||
file like this: | ||
@@ -64,4 +64,12 @@ | ||
TypeScript 2: | ||
``` | ||
npm i -D @types/jasmine | ||
``` | ||
TypeScript 1: | ||
``` | ||
typings i -DG dt~jasmine | ||
``` | ||
Since `0.1.3` [ts-node options](https://www.npmjs.com/package/ts-node#configuration-options) are passed through to ts-node. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
41061
62
73
4
5
+ Addedyargs@^8.0.1
+ Addedansi-regex@3.0.1(transitive)
+ Addedcamelcase@4.1.0(transitive)
+ Addedcliui@3.2.0(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addedcross-spawn@5.1.0(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedexeca@0.7.0(transitive)
+ Addedfind-up@2.1.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-caller-file@1.0.3(transitive)
+ Addedget-stream@3.0.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedinvert-kv@1.0.0(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedis-fullwidth-code-point@1.0.02.0.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedlcid@1.0.0(transitive)
+ Addedload-json-file@2.0.0(transitive)
+ Addedlocate-path@2.0.0(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedmem@1.1.0(transitive)
+ Addedmimic-fn@1.2.0(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addednpm-run-path@2.0.2(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedos-locale@2.1.0(transitive)
+ Addedp-finally@1.0.0(transitive)
+ Addedp-limit@1.3.0(transitive)
+ Addedp-locate@2.0.0(transitive)
+ Addedp-try@1.0.0(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@2.0.0(transitive)
+ Addedpify@2.3.0(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedread-pkg@2.0.0(transitive)
+ Addedread-pkg-up@2.0.0(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedrequire-main-filename@1.0.1(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.21(transitive)
+ Addedstring-width@1.0.22.1.1(transitive)
+ Addedstrip-ansi@4.0.0(transitive)
+ Addedstrip-eof@1.0.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwrap-ansi@2.1.0(transitive)
+ Addedy18n@3.2.2(transitive)
+ Addedyallist@2.1.2(transitive)
+ Addedyargs@8.0.2(transitive)
+ Addedyargs-parser@7.0.0(transitive)