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 mocha and gulp test tasks #5

Merged
merged 2 commits into from
Aug 7, 2017
Merged

Add mocha and gulp test tasks #5

merged 2 commits into from
Aug 7, 2017

Conversation

kjin
Copy link
Contributor

@kjin kjin commented Aug 4, 2017

I've added mocha integration into gulp. I'll describe the tasks in full on the wiki, but what's new here is:

  • gulp test transpiles all code (src and test) and runs all tests.
  • gulp test.single --file $FILE transpiles all of src as well as $FILE, and runs the transpiled form of $FILE as a mocha test in the same process. $FILE should be a TypeScript file.

The purpose of the latter file is to make it super easy to debug a TypeScript mocha test file in VS Code. Given the following configuration:

{
  "type": "node",
  "request": "launch",
  "name": "Launch current file as Mocha test",
  "program": "${workspaceRoot}/node_modules/gulp/bin/gulp.js",
  "runtimeExecutable": "/Users/kelvinjin/Documents/node-http2/node", // You'll have to provide your own here; VS Code doesn't read env vars in its launch config
  "args": ["test.single", "--file", "${file}"]
}

This makes it so that when VS Code is told to "Start Debugging" (F5), it will automatically take the currently open file, transpile it, and run it as a Mocha test suite.

Copy link
Member

@nicolasnoble nicolasnoble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; feel free to merge this once you're happy with it.

@kjin kjin merged commit a78e92a into master Aug 7, 2017
@kjin kjin deleted the kjin-tests branch August 9, 2017 00:48
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants