Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,14 @@ function exec(script, stds) { | |
require('coffee-script/register'); | ||
} | ||
|
||
if (p.extname(script).indexOf('.es') > -1 || | ||
pm2_env.next_gen_js) { | ||
require('babel/register')({ | ||
ignore: /node_modules/, | ||
optional: ['es7.objectRestSpread'] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Unitech
Author
Owner
|
||
}); | ||
} | ||
|
||
process.on('message', function (msg) { | ||
if (msg.type === 'log:reload') { | ||
for(var k in stds){ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Test if iojs | ||
# | ||
node -e "process.exit(require('is-iojs') ? 0 : 1)" | ||
if [ $? -eq 0 ] | ||
then | ||
echo "io.js engine" | ||
else | ||
echo "Node.js engine" | ||
exit | ||
fi | ||
|
||
SRC=$(cd $(dirname "$0"); pwd) | ||
source "${SRC}/include.sh" | ||
cd $file_path | ||
|
||
echo -e "\033[1mRunning tests:\033[0m" | ||
|
||
|
||
$pm2 start es6/main.es6 | ||
sleep 1 | ||
|
||
should 'process should have not been restarted' 'restart_time: 0' 1 | ||
|
||
|
||
|
||
$pm2 delete all | ||
|
||
$pm2 start es6/main.js | ||
sleep 1 | ||
|
||
shouldnot 'process should have been restarted' 'restart_time: 0' 1 | ||
|
||
|
||
|
||
$pm2 delete all | ||
|
||
$pm2 start es6/main.js --next-gen-js | ||
sleep 1 | ||
|
||
should 'process should have not been restarted' 'restart_time: 0' 1 | ||
|
||
|
||
$pm2 delete all | ||
|
||
$pm2 start es6/main.js --next-gen-js -i 4 | ||
sleep 1 | ||
|
||
should '(CLUSTER MODE) process should have not been restarted' 'restart_time: 0' 4 | ||
|
||
|
||
$pm2 delete all | ||
|
||
$pm2 start es6/main.es6 -i 4 | ||
sleep 1 | ||
|
||
should '(CLUSTER MODE) process should have not been restarted' 'restart_time: 0' 4 | ||
|
||
|
||
|
||
$pm2 delete all | ||
|
||
$pm2 start es6/main.js -i 4 | ||
sleep 1 | ||
|
||
shouldnot '(CLUSTER MODE WITHOUT ES6) process should have been restarted' 'restart_time: 0' 4 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
export class Person { | ||
constructor(firstName, lastName) { | ||
this.firstName = firstName; | ||
this.lastName = lastName; | ||
} | ||
|
||
get name() { | ||
return this.firstName + ' ' + this.lastName; | ||
} | ||
|
||
toString() { | ||
return this.name; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
export class Shape { | ||
constructor (id, x, y) { | ||
this.id = id | ||
this.move(x, y) | ||
} | ||
move (x, y) { | ||
this.x = x | ||
this.y = y | ||
} | ||
} | ||
|
||
export class Rectangle extends Shape { | ||
constructor (id, x, y, width, height) { | ||
super(id, x, y) | ||
this.width = width | ||
this.height = height | ||
} | ||
} | ||
|
||
export class Circle extends Shape { | ||
constructor (id, x, y, radius) { | ||
super(id, x, y) | ||
this.radius = radius | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
export const sqrt = Math.sqrt; | ||
|
||
export function square(x) { | ||
return x * x; | ||
} | ||
|
||
export function diag(x, y) { | ||
return sqrt(square(x) + square(y)); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
|
||
var assert = require('assert'); | ||
|
||
/** | ||
* Simple import | ||
*/ | ||
import { square, diag } from './lib'; | ||
|
||
console.log('---- simple export'); | ||
console.log(square(11)); | ||
console.log(diag(4, 3)); | ||
|
||
|
||
/** | ||
* Class | ||
*/ | ||
import { Person } from './example-class'; | ||
|
||
var alex = new Person('Alexandre', 'Strzelewicz'); | ||
|
||
console.log('---- get attribute'); | ||
|
||
assert.equal(alex.name, 'Alexandre Strzelewicz'); | ||
|
||
console.log(alex.name); | ||
|
||
/** | ||
* const, let | ||
*/ | ||
|
||
const dure = 'constant'; | ||
|
||
// String interpolation | ||
let msg = `Hey ${dure}`; | ||
|
||
assert.equal(msg, 'Hey constant'); | ||
|
||
console.log(msg); | ||
|
||
// Multiline | ||
|
||
let msg2 = `Hey my name is | ||
${alex.name} and | ||
I eat potatoes`; | ||
|
||
console.log(msg2); | ||
|
||
|
||
// Spread operator | ||
|
||
var params = [ "hello", true, 7 ]; | ||
var other = [ 1, 2, ...params ]; // [ 1, 2, "hello", true, 7 ] | ||
console.log(other); | ||
|
||
var str = "foo"; | ||
var chars = [...str ]; // [ "f", "o", "o" ] | ||
|
||
console.log(chars); | ||
|
||
assert.deepEqual(chars, ['f', 'o', 'o']); | ||
|
||
// Extended parameter handling | ||
|
||
function f (x, y, ...a) { | ||
return (x + y) * a.length | ||
} | ||
|
||
assert.equal(f(1, 2, "hello", true, 7), 9); | ||
|
||
// Destructuring arguments | ||
|
||
var list = [ 7, 42 ] | ||
var [ a = 1, b = 2, c = 3, d ] = list | ||
assert.equal(a, 7) | ||
assert.equal(b, 42) | ||
assert.equal(c, 3) | ||
assert.equal(d, undefined); | ||
|
||
// Inheritance test | ||
|
||
import { Circle } from './inheritance'; | ||
|
||
var c = new Circle('noun', 10, 20, 30); | ||
|
||
|
||
|
||
setInterval(function() { | ||
}, 1000) | ||
// From | ||
// http://es6-features.org/ |
will it be possible to set a custom babel config? for example, I need to pass
stage: 0
here for some of my projects.