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.

Revisions

  1. seanpmaxwell revised this gist May 29, 2019. 1 changed file with 12 additions and 6 deletions.
    18 changes: 12 additions & 6 deletions start.ts
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,17 @@
    import { cinfo, cerr } from 'simple-color-print';
    import { Logger } from '@overnightjs/logger';
    import DemoServer from './DemoServer';


    // Start the server or run tests
    if (process.argv[2] !== 'test') {
    if (process.env.NODE_ENV !== 'testing') {

    let server = new DemoServer();
    server.start();
    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": [
    @@ -17,14 +20,17 @@ if (process.argv[2] !== 'test') {
    "stopSpecOnExpectationFailure": false,
    "random": true
    });

    jasmine.onComplete((passed: boolean) => {
    if (passed) {
    cinfo('All tests have passed :)');
    Logger.Info('All tests have passed :)');
    } else {
    cerr('At least one test has failed :(');
    Logger.Err('At least one test has failed :(');
    }
    });

    let testPath = process.argv[3];

    if (testPath) {
    testPath = `./src/${testPath}.test.ts`;
    jasmine.execute([testPath]);
  2. seanpmaxwell revised this gist May 18, 2019. 1 changed file with 0 additions and 9 deletions.
    9 changes: 0 additions & 9 deletions start.ts
    Original file line number Diff line number Diff line change
    @@ -2,18 +2,13 @@ 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": [
    @@ -22,18 +17,14 @@ if (process.argv[2] !== 'test') {
    "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]);
  3. seanpmaxwell renamed this gist Mar 3, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. seanpmaxwell revised this gist Feb 14, 2019. 1 changed file with 15 additions and 15 deletions.
    30 changes: 15 additions & 15 deletions start.js
    Original file line number Diff line number Diff line change
    @@ -1,31 +1,29 @@
    import { cinfo, cerr } from 'simple-color-print'
    import { cinfo, cerr } from 'simple-color-print';
    import DemoServer from './DemoServer';

    if (process.argv[2] === 'dev') {

    process.env.NODE_ENV = 'development';
    require('./src/DemoServer');

    } else if (process.argv[2] === 'prod') {
    // Start the server or run tests
    if (process.argv[2] !== 'test') {

    process.env.NODE_ENV = 'production';
    let server = new DemoServer();
    server.start();

    } else if (process.argv[2] === 'test') {

    process.env.NODE_ENV = 'test';
    } else {

    const Jasmine = require('jasmine');
    let jasmine = new Jasmine();
    const jasmine = new Jasmine();

    jasmine.loadConfig({
    "spec_dir": "src",
    "spec_files": [
    "./controllers/**/*.test.js"
    "./controllers/**/*.test.ts"
    ],
    "stopSpecOnExpectationFailure": false,
    "random": true
    });

    jasmine.onComplete(passed => {
    jasmine.onComplete((passed: boolean) => {

    if (passed) {
    cinfo('All tests have passed :)');
    @@ -34,9 +32,11 @@ if (process.argv[2] === 'dev') {
    }
    });

    if (process.argv[3]) {
    let test = `./src/${process.argv[3]}.test.js`;
    jasmine.execute([test], test);
    let testPath = process.argv[3];

    if (testPath) {
    testPath = `./src/${testPath}.test.ts`;
    jasmine.execute([testPath]);
    } else {
    jasmine.execute();
    }
  5. seanpmaxwell revised this gist Feb 2, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions start.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    import { cinfo, cerr } from 'simple-color-print'

    if (process.argv[2] === 'dev') {

    process.env.NODE_ENV = 'development';
  6. seanpmaxwell created this gist Jan 25, 2019.
    41 changes: 41 additions & 0 deletions start.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    if (process.argv[2] === 'dev') {

    process.env.NODE_ENV = 'development';
    require('./src/DemoServer');

    } else if (process.argv[2] === 'prod') {

    process.env.NODE_ENV = 'production';

    } else if (process.argv[2] === 'test') {

    process.env.NODE_ENV = 'test';

    const Jasmine = require('jasmine');
    let jasmine = new Jasmine();

    jasmine.loadConfig({
    "spec_dir": "src",
    "spec_files": [
    "./controllers/**/*.test.js"
    ],
    "stopSpecOnExpectationFailure": false,
    "random": true
    });

    jasmine.onComplete(passed => {

    if (passed) {
    cinfo('All tests have passed :)');
    } else {
    cerr('At least one test has failed :(');
    }
    });

    if (process.argv[3]) {
    let test = `./src/${process.argv[3]}.test.js`;
    jasmine.execute([test], test);
    } else {
    jasmine.execute();
    }
    }