Skip to content

Commit

Permalink
#5682 add test for bun over ts and tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Oct 6, 2023
1 parent 7bbe1a5 commit f122aab
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/workflows/node.js.yml
Expand Up @@ -18,6 +18,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
Expand Down
7 changes: 0 additions & 7 deletions lib/Common.js
Expand Up @@ -467,13 +467,6 @@ Common.sink.resolveInterpreter = function(app) {
if (app.exec_interpreter.indexOf('python') > -1)
app.env.PYTHONUNBUFFERED = '1'

/**
* Specific installed JS transpilers
*/
if (app.exec_interpreter == 'ts-node') {
app.exec_interpreter = path.resolve(__dirname, '../node_modules/.bin/ts-node');
}

if (app.exec_interpreter == 'lsc') {
app.exec_interpreter = path.resolve(__dirname, '../node_modules/.bin/lsc');
}
Expand Down
1 change: 1 addition & 0 deletions test/e2e.sh
Expand Up @@ -16,6 +16,7 @@ runTest ./test/e2e/cli/reload.sh
runTest ./test/e2e/cli/start-app.sh
runTest ./test/e2e/cli/operate-regex.sh
runTest ./test/e2e/cli/interpreter.sh
runTest ./test/e2e/cli/bun.sh
runTest ./test/e2e/cli/app-configuration.sh
runTest ./test/e2e/cli/binary.sh
runTest ./test/e2e/cli/startOrX.sh
Expand Down
32 changes: 32 additions & 0 deletions test/e2e/cli/bun.sh
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/../include.sh"

cd $file_path/interpreter

########### typescript fork test
$pm2 delete all

>typescript.log

$pm2 start echo.ts -o typescript.log --merge-logs

sleep 1.5

grep "Hello Typescript!" typescript.log
spec "Should work on Typescript files in fork mode"

# ########### typescript cluster test
$pm2 delete all

>typescript.log

$pm2 start echo.tsx -o typescript.log --merge-logs

sleep 1.5

grep "Hello Typescript!" typescript.log
spec "Should work on Typescript files in fork mode"

$pm2 delete all
30 changes: 0 additions & 30 deletions test/e2e/cli/interpreter.sh
Expand Up @@ -71,33 +71,3 @@ should 'process should be online' "status: 'online'" 1
# sleep 1.5
# grep "Hello Livescript!" livescript.log
# spec "Should work on Livescript files in cluster mode"

########### TYPESCRIPT

########### Install


# $pm2 install typescript

# ########### typescript fork test
# $pm2 delete all

# >typescript.log

# $pm2 start echo.ts -o typescript.log --merge-logs

# sleep 1.5

# grep "Hello Typescript!" typescript.log
# spec "Should work on Typescript files in fork mode"

# ########### typescript cluster test
# $pm2 delete all

# >typescript.log

# $pm2 start echo.ts -i 1 -o typescript.log --merge-logs

# sleep 1.5
# grep "Hello Typescript!" typescript.log
# spec "Should work on Typescript files in cluster mode"
11 changes: 11 additions & 0 deletions test/fixtures/interpreter/echo.tsx
@@ -0,0 +1,11 @@

class Greeter {
constructor(public greeting: string) { }
greet() {
return this.greeting;
}
};

var greeter = new Greeter("Hello Typescript!");

console.log(greeter.greet());

1 comment on commit f122aab

@dtmrc
Copy link

@dtmrc dtmrc commented on f122aab Jan 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why use bun?

Please sign in to comment.