mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
\#3248 add test file
This commit is contained in:
parent
7591c74f22
commit
56280887b1
22
test/bash/mjs.sh
Normal file
22
test/bash/mjs.sh
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SRC=$(cd $(dirname "$0"); pwd)
|
||||
source "${SRC}/include.sh"
|
||||
|
||||
cd $file_path/mjs
|
||||
|
||||
# Activate test only for Node > 9.0.0
|
||||
node -e "require('semver').gte(process.versions.node, '9.0.0') ? process.exit(0) : process.exit(1)"
|
||||
[ $? -eq 0 ] || exit 0
|
||||
|
||||
$pm2 start --node-args="--experimental-modules" index.mjs -o outech.log -e errech.log
|
||||
>outech.log
|
||||
>errech.log
|
||||
sleep 1
|
||||
should 'should app be online in fork mode with MJS support' 'online' 1
|
||||
|
||||
$pm2 delete all
|
||||
|
||||
$pm2 start --node-args="--experimental-modules" -i 2 index.mjs
|
||||
sleep 1
|
||||
should 'should app be online in cluster mode with MJS support' 'online' 2
|
||||
14
test/fixtures/mjs/ecosystem.config.js
vendored
Normal file
14
test/fixtures/mjs/ecosystem.config.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
|
||||
apps : [
|
||||
|
||||
|
||||
{
|
||||
name : 'Test es6 modules',
|
||||
script : 'index.mjs',
|
||||
node_args : '--experimental-modules'
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
};
|
||||
3
test/fixtures/mjs/index.mjs
vendored
Normal file
3
test/fixtures/mjs/index.mjs
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import {test} from './test'
|
||||
|
||||
test();
|
||||
18
test/fixtures/mjs/package.json
vendored
Normal file
18
test/fixtures/mjs/package.json
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "test-es6-pm2",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple project to test pm2 es6-modules pm2 support",
|
||||
"main": "index.mjs",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node --experimental-modules index.mjs"
|
||||
},
|
||||
"keywords": [
|
||||
"es6-modules",
|
||||
"import",
|
||||
"export",
|
||||
"pm2"
|
||||
],
|
||||
"author": "vpotseluyko",
|
||||
"license": "ISC"
|
||||
}
|
||||
3
test/fixtures/mjs/test.mjs
vendored
Normal file
3
test/fixtures/mjs/test.mjs
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export function test() {
|
||||
setInterval(() => console.log(`Hello es6 from pm2`), 1000);
|
||||
}
|
||||
@ -33,6 +33,8 @@ spec "resurrect test"
|
||||
# spec "Docker tests"
|
||||
bash ./test/bash/nvm-node-version.sh
|
||||
spec "NVM node version setting"
|
||||
bash ./test/bash/mjs.sh
|
||||
spec "Test import syntax"
|
||||
|
||||
bash ./test/bash/cron-system.sh
|
||||
spec "Cron system tests"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user