Skip to content

Commit

Permalink
rake format
Browse files Browse the repository at this point in the history
kateinoigakukun committed Dec 3, 2023
1 parent d6c94b7 commit 0ad0940
Showing 7 changed files with 41 additions and 37 deletions.
13 changes: 7 additions & 6 deletions lib/ruby_wasm/build.rb
Original file line number Diff line number Diff line change
@@ -10,12 +10,13 @@ class BuildExecutor
def initialize(verbose: false, process_count: nil)
@verbose = verbose
@github_actions_markup = ENV["ENABLE_GITHUB_ACTIONS_MARKUP"] != nil
__skip__ = begin
require "etc"
@process_count = process_count || Etc.nprocessors
rescue LoadError
@process_count = process_count || 1
end
__skip__ =
begin
require "etc"
@process_count = process_count || Etc.nprocessors
rescue LoadError
@process_count = process_count || 1
end
end

def system(*args, chdir: nil, env: nil)
6 changes: 3 additions & 3 deletions packages/npm-packages/ruby-wasm-wasi/README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

This package is a template for each channel-specific package.

| Channel | Package |
| ------- | ------------------------------------------------- |
| Channel | Package |
| ------- | -------------------------------------------------- |
| `head` | [`@ruby/head-wasm-wasi`](./../ruby-head-wasm-wasi) |
| `3.2` | [`@ruby/3.2-wasm-wasi`](./../ruby-3.2-wasm-wasi) |
| `3.2` | [`@ruby/3.2-wasm-wasi`](./../ruby-3.2-wasm-wasi) |
4 changes: 2 additions & 2 deletions packages/npm-packages/ruby-wasm-wasi/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -17,8 +17,8 @@ function config({ basename }) {
nodePolyfills(),
inject({ Buffer: ["buffer", "Buffer"] }),
typescript(typescriptOptions),
nodeResolve({ resolveOnly: ["@wasmer/wasi"] })
]
nodeResolve({ resolveOnly: ["@wasmer/wasi"] }),
],
};
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { test, expect, Page } from "@playwright/test";

import { setupDebugLog, setupProxy, setupUncaughtExceptionRejection, expectUncaughtException } from "../support";
import {
setupDebugLog,
setupProxy,
setupUncaughtExceptionRejection,
expectUncaughtException,
} from "../support";

if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
test.skip("skip", () => {});
@@ -63,6 +68,4 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
expect(await resolve()).toBe("ok");
});
});
test.describe('data-eval="async" crash', () => {
});
}
30 changes: 16 additions & 14 deletions packages/npm-packages/ruby-wasm-wasi/test-e2e/support.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,8 @@ export const setupDebugLog = (context: BrowserContext) => {
};

export const setupProxy = (context: BrowserContext) => {
const cdnPattern = /cdn.jsdelivr.net\/npm\/@ruby\/.+-wasm-wasi@.+\/dist\/(.+)/;
const cdnPattern =
/cdn.jsdelivr.net\/npm\/@ruby\/.+-wasm-wasi@.+\/dist\/(.+)/;
context.route(cdnPattern, (route) => {
const request = route.request();
console.log(">> [MOCK]", request.method(), request.url());
@@ -29,16 +30,17 @@ export const setupProxy = (context: BrowserContext) => {
});
};

export const { setupUncaughtExceptionRejection, expectUncaughtException } = (() => {
const rejectUncaughtException = (err: Error) => {
expect(err).toEqual(undefined);
}
return {
setupUncaughtExceptionRejection: (page: Page) => {
page.on("pageerror", rejectUncaughtException);
},
expectUncaughtException: (page: Page) => {
page.off("pageerror", rejectUncaughtException);
},
}
})()
export const { setupUncaughtExceptionRejection, expectUncaughtException } =
(() => {
const rejectUncaughtException = (err: Error) => {
expect(err).toEqual(undefined);
};
return {
setupUncaughtExceptionRejection: (page: Page) => {
page.on("pageerror", rejectUncaughtException);
},
expectUncaughtException: (page: Page) => {
page.off("pageerror", rejectUncaughtException);
},
};
})();
4 changes: 1 addition & 3 deletions packages/npm-packages/ruby-wasm-wasi/test/init.js
Original file line number Diff line number Diff line change
@@ -19,9 +19,7 @@ const rubyModule = (async () => {
return await WebAssembly.compile(binary.buffer);
})();

const initRubyVM = async (
{ suppressStderr } = { suppressStderr: false },
) => {
const initRubyVM = async ({ suppressStderr } = { suppressStderr: false }) => {
let preopens = {};
if (process.env.RUBY_ROOT) {
preopens["/usr"] = path.join(process.env.RUBY_ROOT, "./usr");
12 changes: 6 additions & 6 deletions packages/npm-packages/ruby-wasm-wasi/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"esModuleInterop": true,
"outDir": "./dist/cjs"
}
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"esModuleInterop": true,
"outDir": "./dist/cjs"
}
}

0 comments on commit 0ad0940

Please sign in to comment.