Skip to content

Commit

Permalink
nodejs: run JS test suite as part of the checks
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed May 29, 2024
1 parent a21afc1 commit b26563a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
10 changes: 8 additions & 2 deletions pkgs/development/web/nodejs/nodejs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,16 @@ let
"build-node-api-tests"
"tooltest"
"cctest"
"test-ci-js"
];

# Do not create __pycache__ when running tests.
checkFlags = [ "PYTHONDONTWRITEBYTECODE=1" ];
checkFlags = [
# Do not create __pycache__ when running tests.
"PYTHONDONTWRITEBYTECODE=1"
"FLAKY_TESTS=skip"
# Skip some tests that are not passing in this context
"CI_SKIP_TESTS=test-setproctitle,test-tls-cli-max-version-1.3,test-tls-client-auth,test-child-process-exec-env,test-fs-write-stream-eagain,test-tls-sni-option,test-https-foafssl,test-child-process-uid-gid,test-process-euid-egid,test-process-initgroups,test-process-uid-gid,test-process-setgroups"
];

postInstall = ''
HOST_PATH=$out/bin patchShebangs --host $out
Expand Down
24 changes: 24 additions & 0 deletions pkgs/development/web/nodejs/use-correct-env-in-tests.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
`/usr/bin/env` is not available.

--- old/test/common/assertSnapshot.js
+++ new/test/common/assertSnapshot.js
@@ -81,2 +81,2 @@ async function spawnAndAssert(filename, transform = (x) => x, { tty = false, ...
- const executable = tty ? 'tools/pseudo-tty.py' : process.execPath;
- const args = tty ? [process.execPath, ...flags, filename] : [...flags, filename];
+ const executable = tty ? 'python3' : process.execPath;
+ const args = tty ? ['tools/pseudo-tty.py', process.execPath, ...flags, filename] : [...flags, filename];
--- old/test/parallel/test-child-process-default-options.js
+++ new/test/parallel/test-child-process-default-options.js
@@ -35 +35 @@ if (isWindows) {
- child = spawn('/usr/bin/env', [], {});
+ child = spawn('env', [], {});
--- old/test/parallel/test-child-process-env.js
+++ new/test/parallel/test-child-process-env.js
@@ -51 +51 @@ if (isWindows) {
- child = spawn('/usr/bin/env', [], { env });
+ child = spawn('env', [], { env });
--- old/test/parallel/test-child-process-exec-env.js
+++ new/test/parallel/test-child-process-exec-env.js
@@ -47 +47 @@ if (!isWindows) {
- child = exec('/usr/bin/env', { env: { 'HELLO': 'WORLD' } }, after);
+ child = exec('env', { env: { 'HELLO': 'WORLD' } }, after);
7 changes: 6 additions & 1 deletion pkgs/development/web/nodejs/v18.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ callPackage, lib, overrideCC, pkgs, buildPackages, openssl, python3, enableNpm ? true }:
{ callPackage, lib, overrideCC, pkgs, buildPackages, openssl, python3, fetchpatch2, enableNpm ? true }:

let
# Clang 16+ cannot build Node v18 due to -Wenum-constexpr-conversion errors.
Expand Down Expand Up @@ -27,5 +27,10 @@ buildNodejs {
./revert-arm64-pointer-auth.patch
./node-npm-build-npm-package-logic.patch
./trap-handler-backport.patch
./use-correct-env-in-tests.patch
(fetchpatch2 {
url = "https://github.com/nodejs/node/commit/534c122de166cb6464b489f3e6a9a544ceb1c913.patch";
hash = "sha256-4q4LFsq4yU1xRwNsM1sJoNVphJCnxaVe2IyL6AeHJ/I=";
})
];
}
7 changes: 6 additions & 1 deletion pkgs/development/web/nodejs/v20.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ callPackage, openssl, python3, enableNpm ? true }:
{ callPackage, fetchpatch2, openssl, python3, enableNpm ? true }:

let
buildNodejs = callPackage ./nodejs.nix {
Expand All @@ -15,5 +15,10 @@ buildNodejs {
./disable-darwin-v8-system-instrumentation-node19.patch
./bypass-darwin-xcrun-node16.patch
./node-npm-build-npm-package-logic.patch
./use-correct-env-in-tests.patch
(fetchpatch2 {
url = "https://github.com/nodejs/node/commit/534c122de166cb6464b489f3e6a9a544ceb1c913.patch";
hash = "sha256-4q4LFsq4yU1xRwNsM1sJoNVphJCnxaVe2IyL6AeHJ/I=";
})
];
}
7 changes: 6 additions & 1 deletion pkgs/development/web/nodejs/v22.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ callPackage, openssl, python3, enableNpm ? true }:
{ callPackage, fetchpatch2, openssl, python3, enableNpm ? true }:

let
buildNodejs = callPackage ./nodejs.nix {
Expand All @@ -14,5 +14,10 @@ buildNodejs {
./disable-darwin-v8-system-instrumentation-node19.patch
./bypass-darwin-xcrun-node16.patch
./node-npm-build-npm-package-logic.patch
./use-correct-env-in-tests.patch
(fetchpatch2 {
url = "https://github.com/nodejs/node/commit/534c122de166cb6464b489f3e6a9a544ceb1c913.patch";
hash = "sha256-4q4LFsq4yU1xRwNsM1sJoNVphJCnxaVe2IyL6AeHJ/I=";
})
];
}

0 comments on commit b26563a

Please sign in to comment.