Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
sudo apt install -y xvfb curl
pnpm run test-prepare
ls -l build
ls -l test/runner/nwjs/wcc/build/Release
ls -l test/runner/addon/wcc/build/Release
# fix: 预先运行,做一下配置,不然第一次执行会有问题
./test/wine/wcc.exe || true
./test/wine/wcc.exe -v || true
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@babel/core": "^7.18.13",
"@babel/preset-env": "^7.18.10",
"@babel/register": "^7.18.9",
"@types/jest": "^30.0.0",
"@types/mocha": "^10.0.1",
"@types/node": "^20.4.5",
"assert": "^2.0.0",
Expand Down
282 changes: 282 additions & 0 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
#! /bin/bash

set -ex

Xvfb :98 & # Start xvfb on display :98
export DISPLAY=:98
set -ex
root_dir=$(cd `dirname $0`/../../.. && pwd -P)
cur_dir=$(cd `dirname $0` && pwd -P)

nw_version="0.55.0"
mkdir -p "$root_dir/cache"
if [ ! -f "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64.zip" ];then
wget -c -O "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64.zip.tmp" "https://dl.nwjs.io/v0.55.0/nwjs-sdk-v0.55.0-win-x64.zip"
mv "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64.zip.tmp" "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64.zip"
fi
if [ ! -d "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64" ];then
cd "$root_dir/cache"
unzip "nwjs-sdk-v$nw_version-win-x64.zip"
if [ ! -f "$root_dir/cache/node.exe" ];then
wget -c -O "$root_dir/cache/node.exe.tmp" "https://github.com/msojocs/skyline-node/releases/download/v16.4.0-1/node.exe"
mv "$root_dir/cache/node.exe.tmp" "$root_dir/cache/node.exe"
fi

if [ ! -f "$root_dir/cache/nwjs-sdk-v$nw_version-linux-x64.tar.gz" ];then
wget -c -O "$root_dir/cache/nwjs-sdk-v$nw_version-linux-x64.tar.gz.tmp" "https://dl.nwjs.io/v0.55.0/nwjs-sdk-v0.55.0-linux-x64.tar.gz"
mv "$root_dir/cache/nwjs-sdk-v$nw_version-linux-x64.tar.gz.tmp" "$root_dir/cache/nwjs-sdk-v$nw_version-linux-x64.tar.gz"
fi

if [ ! -d "$root_dir/cache/nwjs-sdk-v$nw_version-linux-x64" ];then
cd "$root_dir/cache"
tar -zxf "nwjs-sdk-v$nw_version-linux-x64.tar.gz"
if [ ! -f "$root_dir/cache/node.dll" ];then
wget -c -O "$root_dir/cache/node.dll.tmp" "https://github.com/msojocs/skyline-node/releases/download/v16.4.0-1/node.dll"
mv "$root_dir/cache/node.dll.tmp" "$root_dir/cache/node.dll"
fi

rm -rf "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64/package.nw"
cp -r "$cur_dir/package.nw" "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64"

docker_start(){
docker run -d -i\
docker run -d -it\
--rm\
--volume=$root_dir:/workspace\
--env=USE_XVFB=yes\
Expand All @@ -42,12 +30,11 @@ docker_start(){
--hostname=DESKTOP-1TV4OA1\
--name=wine\
--shm-size=1g\
--workdir=/home/wineuser\
--workdir=/workspace/cache\
--env=TZ=Asia/Shanghai\
--volume=winehome:/home/wineuser\
-p 8083:8083\
scottyhardy/docker-wine\
wine /workspace/cache/nwjs-sdk-v$nw_version-win-x64/nw.exe
wine node.exe ../test/runner/addon/win/main.js

i=0
until $(curl --output /dev/null --silent --head --fail http://127.0.0.1:8083/check); do
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
console.log("====================================================================");
console.log("==============================main.js===============================");
console.log("====================================================================");
const fs = require("fs");
console.log("fs:", fs);
const wcc = require("./wcc");
const path = require("path");
const wcc = require(path.resolve(__dirname, "./wcc"));
console.log("wcc:", wcc);
require(path.resolve(__dirname, "./wcc/build/Release/wcc.node"));
require(path.resolve(__dirname, "./wcc/build/Release/wcsc.node"));

const { createServer } = require("http");

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions test/runner/module-linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ const NW_VERSION = '0.55.0'
const wcscNative = (optionsPath: string, projectPath: string, outputPath: string | undefined = undefined): Promise<CompilerResult> => {

const nodeExec = spawn(
path.resolve(__dirname, `../../cache/nwjs-sdk-v${NW_VERSION}-linux-x64/nw`),
[ path.resolve(__dirname, './nwjs/compiler.js'), 'wcsc', optionsPath ],
'node',
[ path.resolve(__dirname, './addon/compiler.js'), 'wcsc', optionsPath ],
{
cwd: projectPath,
env: {
WX_DEBUG_COMPILER_OUTPUT: outputPath,
...process.env
},
// stdio: 'inherit'
}
Expand Down Expand Up @@ -63,11 +64,12 @@ const wcscNative = (optionsPath: string, projectPath: string, outputPath: string
const wccNative = (optionsPath: string, outputPath: string | undefined = undefined): Promise<CompilerResult> => {

const nodeExec = spawn(
path.resolve(__dirname, `../../cache/nwjs-sdk-v${NW_VERSION}-linux-x64/nw`),
[path.resolve(__dirname, './nwjs/compiler.js'), 'wcc', optionsPath],
'node',
[path.resolve(__dirname, './addon/compiler.js'), 'wcc', optionsPath],
{
env: {
WX_DEBUG_COMPILER_OUTPUT: outputPath,
...process.env
},
// stdio: 'inherit'
}
Expand Down
2 changes: 1 addition & 1 deletion test/runner/module-windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default {
wcsc: wcscNative,
wcc: wccNative,
start: () => {
execFileSync(path.resolve(__dirname, './nwjs/module-prepare.sh'), { stdio: 'inherit' })
execFileSync(path.resolve(__dirname, './addon/addon-prepare.sh'), { stdio: 'inherit' })
},
close: () => {
request('http://127.0.0.1:8083/close').end()
Expand Down
13 changes: 0 additions & 13 deletions test/runner/nwjs/package.nw/index.html

This file was deleted.

6 changes: 3 additions & 3 deletions test/spec/issue/115/issue115.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ describe("issue - 115", function () {
// console.log('windows:', typeof w)
// console.log('linux:', typeof n)

assert.equal(typeof n, typeof w);
assert.equal(w.success, false)
assert.equal(typeof n, typeof w, 'Type mismatch');
assert.equal(w.success, false, 'Success flag mismatch');
fs.writeFileSync(
`${storagePath}/wine-output.json`,
JSON.stringify(w, null, 4)
Expand All @@ -32,7 +32,7 @@ describe("issue - 115", function () {
`${storagePath}/node-output.json`,
JSON.stringify(n, null, 4)
);
assert.deepEqual(n, w);
assert.deepEqual(n, w, 'Output data mismatch');
});
});
});
2 changes: 1 addition & 1 deletion test/spec/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e
test_dir=$(cd `dirname $0`/.. && pwd -P)
"$test_dir/runner/nwjs/module-prepare.sh"
"$test_dir/runner/addon/addon-prepare.sh"
"$test_dir/spec/issue/prepare.sh"
project_dir="$test_dir/projects"

Expand Down
21 changes: 21 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"strict": true,
"target": "esnext",
"allowJs": false,
"lib": ["ES6"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noImplicitThis": false,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
},
"types": ["jest", "node"],
"include": [
"test/**/*.ts"
],
"ts-node": {
"esm": true,
"experimentalSpecifierResolution": "node"
}
}
Loading