Coder Social home page Coder Social logo

izhaki / typescript-jasmine-istanbul-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 6.0 5 KB

An example node project to produce coverage of TypeScript sources using Jasmine

License: MIT License

TypeScript 100.00%
typescript istanbul jasmine sourcemaps boilerplate

typescript-jasmine-istanbul-boilerplate's Introduction

Typescript-Jasmine-Istanbul-Boilerplate

An example node project to produce coverage of TypeScript sources using:

  • Jasmine
  • Istanbul
  • tsc
  • npm scripts

The coverage report shows the typescript (rather than transpiled) code. That is, sourcemaps are properly handled.

$ npm install
$ npm run test:coverage

Sample output:

image

typescript-jasmine-istanbul-boilerplate's People

Contributors

izhaki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

typescript-jasmine-istanbul-boilerplate's Issues

SyntaxError: missing ) after argument list

Steps to Reproduce

git clone [email protected]:Izhaki/Typescript-Jasmine-Istanbul-Boilerplate.git
cd Typescript-Jasmine-Istanbul-Boilerplate
npm install -y
npm run test:coverage

Error

> [email protected] test:coverage C:\temp\Typescript-Jasmine-Istanbul-Boilerplate
> ts-node node_modules/istanbul/lib/cli.js cover -e .ts  -x "*.d.ts" -x "*.spec.ts" node_modules/.bin/jasmine -- JASMINE_CONFIG_PATH=jasmine.json

SyntaxError: missing ) after argument list
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at runFn (C:\temp\Typescript-Jasmine-Istanbul-Boilerplate\node_modules\istanbul\lib\command\cover.js:126:16)
    at C:\temp\Typescript-Jasmine-Istanbul-Boilerplate\node_modules\istanbul\lib\command\cover.js:146:9
    at C:\temp\Typescript-Jasmine-Istanbul-Boilerplate\node_modules\istanbul\node_modules\istanbul-api\lib\run-cover.js:187:16
    at C:\temp\Typescript-Jasmine-Istanbul-Boilerplate\node_modules\istanbul\node_modules\istanbul-api\lib\file-matcher.js:69:16
No coverage information was collected, exit without writing coverage information

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test:coverage"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test:coverage: `ts-node node_modules/istanbul/lib/cli.js cover -e .ts  -x "*.d.ts" -x "*.spec.ts" node_modules/.bin/jasmine -- JASMINE_CONFIG_PATH=jasmine.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test:coverage script 'ts-node node_modules/istanbul/lib/cli.js cover -e .ts  -x "*.d.ts" -x "*.spec.ts" node_modules/.bin/jasmine -- JASMINE_CONFIG_PATH=jasmine.json'.
npm ERR! This is most likely a problem with the typescript-jasmine-istanbul-boilerplate package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ts-node node_modules/istanbul/lib/cli.js cover -e .ts  -x "*.d.ts" -x "*.spec.ts" node_modules/.bin/jasmine -- JASMINE_CONFIG_PATH=jasmine.json
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs typescript-jasmine-istanbul-boilerplate
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls typescript-jasmine-istanbul-boilerplate
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\temp\Typescript-Jasmine-Istanbul-Boilerplate\npm-debug.log

npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'test:coverage' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest:coverage', 'test:coverage', 'posttest:coverage' ]
5 info pretest:coverage [email protected]
6 info test:coverage [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec test:coverage script
9 verbose stack Error: [email protected] test:coverage: `ts-node node_modules/istanbul/lib/cli.js cover -e .ts  -x "*.d.ts" -x "*.spec.ts" node_modules/.bin/jasmine -- JASMINE_CONFIG_PATH=jasmine.json`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:217:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:827:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd C:\temp\Typescript-Jasmine-Istanbul-Boilerplate
12 error Windows_NT 10.0.14393
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test:coverage"
14 error node v4.4.7
15 error npm  v2.15.8
16 error code ELIFECYCLE
17 error [email protected] test:coverage: `ts-node node_modules/istanbul/lib/cli.js cover -e .ts  -x "*.d.ts" -x "*.spec.ts" node_modules/.bin/jasmine -- JASMINE_CONFIG_PATH=jasmine.json`
17 error Exit status 1
18 error Failed at the [email protected] test:coverage script 'ts-node node_modules/istanbul/lib/cli.js cover -e .ts  -x "*.d.ts" -x "*.spec.ts" node_modules/.bin/jasmine -- JASMINE_CONFIG_PATH=jasmine.json'.
18 error This is most likely a problem with the typescript-jasmine-istanbul-boilerplate package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     ts-node node_modules/istanbul/lib/cli.js cover -e .ts  -x "*.d.ts" -x "*.spec.ts" node_modules/.bin/jasmine -- JASMINE_CONFIG_PATH=jasmine.json
18 error You can get information on how to open an issue for this project with:
18 error     npm bugs typescript-jasmine-istanbul-boilerplate
18 error Or if that isn't available, you can get their info via:
18 error
18 error     npm owner ls typescript-jasmine-istanbul-boilerplate
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

Environment

  • Windows 10
  • node v4.4.7

Unable to compile TypeScript

I've cloned the repo, installed the dependencies and tried both scripts. Both are failing to find the Jasmine type definition and even the module that's being tested can't be found

npm run test

> [email protected] test /home/john/Sites/Typescript-Jasmine-Istanbul-Boilerplate
> ts-node node_modules/jasmine/bin/jasmine.js JASMINE_CONFIG_PATH=jasmine.json


/home/john/Sites/Typescript-Jasmine-Istanbul-Boilerplate/node_modules/ts-node/dist/index.js:160
                    throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset));
                    ^
TSError: ⨯ Unable to compile TypeScript
Cannot find type definition file for 'jasmine'. (2688)
src/Point.spec.ts (1,23): Cannot find module './Point'. (2307)
src/Point.spec.ts (3,1): Cannot find name 'describe'. (2304)
src/Point.spec.ts (5,5): Cannot find name 'describe'. (2304)
src/Point.spec.ts (7,9): Cannot find name 'it'. (2304)
src/Point.spec.ts (9,13): Cannot find name 'expect'. (2304)
src/Point.spec.ts (10,13): Cannot find name 'expect'. (2304)
src/Point.spec.ts (15,5): Cannot find name 'describe'. (2304)
src/Point.spec.ts (17,9): Cannot find name 'it'. (2304)
src/Point.spec.ts (21,13): Cannot find name 'expect'. (2304)

npm ERR! Linux 4.10.6-100.fc24.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "test"
npm ERR! node v6.10.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test: `ts-node node_modules/jasmine/bin/jasmine.js JASMINE_CONFIG_PATH=jasmine.json`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test script 'ts-node node_modules/jasmine/bin/jasmine.js JASMINE_CONFIG_PATH=jasmine.json'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the typescript-jasmine-istanbul-boilerplate package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ts-node node_modules/jasmine/bin/jasmine.js JASMINE_CONFIG_PATH=jasmine.json
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs typescript-jasmine-istanbul-boilerplate
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls typescript-jasmine-istanbul-boilerplate
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/john/Sites/Typescript-Jasmine-Istanbul-Boilerplate/npm-debug.log

I've tried adding a tsconfig.json and specifying typeRoots and types but it does't seem to help. Any ideas?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.