Last active
May 29, 2019 05:32
-
-
Save seanpmaxwell/a7f1ca5f36dfa42a89f49609413c6b64 to your computer and use it in GitHub Desktop.
TypeScriptFullStackShell/start.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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