Skip to content

Instantly share code, notes, and snippets.

@seanpmaxwell
Last active May 29, 2019 05:32
Show Gist options
  • Select an option

  • Save seanpmaxwell/a7f1ca5f36dfa42a89f49609413c6b64 to your computer and use it in GitHub Desktop.

Select an option

Save seanpmaxwell/a7f1ca5f36dfa42a89f49609413c6b64 to your computer and use it in GitHub Desktop.
TypeScriptFullStackShell/start.ts
import { cinfo, cerr } from 'simple-color-print';
import DemoServer from './DemoServer';
// Start the server or run tests
if (process.argv[2] !== 'test') {
let server = new DemoServer();
server.start();
} else {
const Jasmine = require('jasmine');
const jasmine = new Jasmine();
jasmine.loadConfig({
"spec_dir": "src",
"spec_files": [
"./controllers/**/*.test.ts"
],
"stopSpecOnExpectationFailure": false,
"random": true
});
jasmine.onComplete((passed: boolean) => {
if (passed) {
cinfo('All tests have passed :)');
} else {
cerr('At least one test has failed :(');
}
});
let testPath = process.argv[3];
if (testPath) {
testPath = `./src/${testPath}.test.ts`;
jasmine.execute([testPath]);
} else {
jasmine.execute();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment