Skip to content

Instantly share code, notes, and snippets.

@seanpmaxwell
Last active May 29, 2019 05:32
Show Gist options
  • Save seanpmaxwell/a7f1ca5f36dfa42a89f49609413c6b64 to your computer and use it in GitHub Desktop.
Save seanpmaxwell/a7f1ca5f36dfa42a89f49609413c6b64 to your computer and use it in GitHub Desktop.
TypeScriptFullStackShell/start.ts
import { Logger } from '@overnightjs/logger';
import DemoServer from './DemoServer';
// Start the server or run tests
if (process.env.NODE_ENV !== 'testing') {
let server = new DemoServer();
server.start(process.env.NODE_ENV === 'development' ? 3001 : 8081);
} 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) {
Logger.Info('All tests have passed :)');
} else {
Logger.Err('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