Skip to content

Commit

Permalink
chore: move tools/node_compat to tests/node_compat/runner (denola…
Browse files Browse the repository at this point in the history
…nd#23025)

The `tools/node_compat/node` submodule has been moved to
`tests/node_compat/runner/suite` and the remaining files within
`tools/node_compat` to `tests/node_compat/runner`.

Most of the changes are of the header within `tests/node_compat/test`
files. The `setup` and `test` tasks within `tests/node_comapt` execute
successfully.

Towards denoland#22525
CC @mmastrac
  • Loading branch information
iuioiua authored Apr 2, 2024
1 parent 2b1c6e1 commit 2908589
Show file tree
Hide file tree
Showing 506 changed files with 524 additions and 522 deletions.
4 changes: 2 additions & 2 deletions .dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"tests/util/std",
"tests/wpt/suite",
"third_party",
"tools/node_compat/TODO.md",
"tools/node_compat/node",
"tests/node_compat/runner/TODO.md",
"tests/node_compat/runner/suite",
"tests/wpt/runner/expectation.json",
"tests/wpt/runner/manifest.json",
"ext/websocket/autobahn/reports"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ const ci = {
if: "matrix.wpt",
},
{
...submoduleStep("./tools/node_compat/node"),
...submoduleStep("./tests/node_compat/runner/suite"),
if: "matrix.job == 'lint' && matrix.os == 'linux'",
},
{
Expand Down Expand Up @@ -653,7 +653,7 @@ const ci = {
name: "node_compat/setup.ts --check",
if: "matrix.job == 'lint' && matrix.os == 'linux'",
run:
"deno run --allow-write --allow-read --allow-run=git ./tools/node_compat/setup.ts --check",
"deno run --allow-write --allow-read --allow-run=git ./tests/node_compat/runner/setup.ts --check",
},
{
name: "Build debug",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ jobs:
- name: Clone submodule ./tests/wpt/suite
run: git submodule update --init --recursive --depth=1 -- ./tests/wpt/suite
if: '!(matrix.skip) && (matrix.wpt)'
- name: Clone submodule ./tools/node_compat/node
run: git submodule update --init --recursive --depth=1 -- ./tools/node_compat/node
- name: Clone submodule ./tests/node_compat/runner/suite
run: git submodule update --init --recursive --depth=1 -- ./tests/node_compat/runner/suite
if: '!(matrix.skip) && (matrix.job == ''lint'' && matrix.os == ''linux'')'
- name: 'Create source tarballs (release, linux)'
if: |-
Expand Down Expand Up @@ -388,7 +388,7 @@ jobs:
run: deno run --unstable --allow-write --allow-read --allow-run --allow-net ./tools/lint.js
- name: node_compat/setup.ts --check
if: '!(matrix.skip) && (matrix.job == ''lint'' && matrix.os == ''linux'')'
run: deno run --allow-write --allow-read --allow-run=git ./tools/node_compat/setup.ts --check
run: deno run --allow-write --allow-read --allow-run=git ./tests/node_compat/runner/setup.ts --check
- name: Build debug
if: '!(matrix.skip) && (matrix.job == ''test'' && matrix.profile == ''debug'')'
run: |-
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
path = tests/wpt/suite
url = https://github.com/web-platform-tests/wpt.git

[submodule "tools/node_compat/node"]
path = tools/node_compat/node
[submodule "tests/node_compat/runner/suite"]
path = tests/node_compat/runner/suite
url = https://github.com/denoland/node_test.git
5 changes: 3 additions & 2 deletions ext/node/polyfills/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ const leftPad = require("left-pad");

### Setting up the test runner and running tests

See [tools/node_compat/README.md](../../../tools/node_compat/README.md).
See
[tests/node_compat/runner/README.md](../../../tests/node_compat/runner/README.md).

### Best practices

Expand Down Expand Up @@ -160,4 +161,4 @@ It's not as clean, but prevents the callback being called twice.

Node compatibility can be measured by how many native Node tests pass. If you'd
like to know what you can work on, check out the list of Node tests remaining
[here](../../../tools/node_compat/TODO.md).
[here](../../../tests/node_compat/runner/TODO.md).
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ against our Node.js compatibility feature.
This directory includes the tools for downloading, setting up, and updating the
Node.js compat testing in Deno repository.

- `//tools/node_compat/setup.ts`
- `//tests/node_compat/runner/setup.ts`
- This script sets up the Node.js compat tests.
- `//tools/node_compat/versions/`
- `//tests/node_compat/runner/versions/`
- Node.js source tarballs and extracted test cases are stored here.
- `//tests/node_compat/config.jsonc`
- This json file stores the settings about which Node.js compat test to run
Expand All @@ -22,7 +22,7 @@ Node.js compat testing in Deno repository.
1. Update `tests` property of `//tests/node_compat/config.jsonc`. For example,
if you want to add `test/parallel/test-foo.js` from Node.js test cases, then
add `test-foo.js` entry in `tests.parallel` array property in `config.jsonc`
1. Run `deno task setup` in `tools/node_compat` dir.
1. Run `deno task setup` in `tests/node_compat/runner` dir.

The above command copies the updated items from Node.js tarball to the Deno
source tree.
Expand All @@ -40,11 +40,11 @@ If the test needs to be ignored in particular platform, then add them in
Node.js compat tests are run as part of `cargo test` command. If you want to run
only the Node.js compat test cases you can use the command
`cargo test node_compat`. If you want to run specific tests you can use the
command `deno task test` (in `tools/node_compat` dir). For example, if you want
to run all test files which contains `buffer` in filename you can use the
command:
command `deno task test` (in `tests/node_compat/runner` dir). For example, if
you want to run all test files which contains `buffer` in filename you can use
the command:

```shellsession
/path/to/deno/tools/node_compat
/path/to/deno/tests/node_compat/runner
$ deno task test buffer
```
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- deno-fmt-ignore-file -->
# Remaining Node Tests

NOTE: This file should not be manually edited. Please edit `tests/node_compat/config.json` and run `deno task setup` in `tools/node_compat` dir instead.
NOTE: This file should not be manually edited. Please edit `tests/node_compat/config.json` and run `deno task setup` in `tests/node_compat/runner` dir instead.

- [abort/test-abort-backtrace.js](https://github.com/nodejs/node/tree/v18.12.1/test/abort/test-abort-backtrace.js)
- [abort/test-abort-fatal-error.js](https://github.com/nodejs/node/tree/v18.12.1/test/abort/test-abort-fatal-error.js)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"imports": {
"@test_util/": "../../test_util/",
"@std/": "../../tests/util/std/"
"@std/": "../../util/std/"
},
"tasks": {
"setup": "deno run --allow-read --allow-write ./setup.ts",
"test": "deno test -A ../../tests/node_compat/test.ts --"
"test": "deno test -A ../test.ts --"
}
}
12 changes: 6 additions & 6 deletions tools/node_compat/setup.ts → tests/node_compat/runner/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { writeAll } from "@std/io/write_all.ts";
import { withoutAll } from "@std/collections/without_all.ts";
import { relative } from "@std/path/posix/relative.ts";

import { config, ignoreList } from "../../tests/node_compat/common.ts";
import { config, ignoreList } from "../common.ts";

const encoder = new TextEncoder();

Expand All @@ -37,9 +37,9 @@ const NODE_IGNORED_TEST_DIRS = [
"wpt",
];

const VENDORED_NODE_TEST = new URL("node/test/", import.meta.url);
const VENDORED_NODE_TEST = new URL("./suite/test/", import.meta.url);
const NODE_COMPAT_TEST_DEST_URL = new URL(
"../../tests/node_compat/test/",
"../test/",
import.meta.url,
);

Expand Down Expand Up @@ -76,7 +76,7 @@ async function updateToDo() {
await file.write(encoder.encode(`<!-- deno-fmt-ignore-file -->
# Remaining Node Tests
NOTE: This file should not be manually edited. Please edit \`tests/node_compat/config.json\` and run \`deno task setup\` in \`tools/node_compat\` dir instead.
NOTE: This file should not be manually edited. Please edit \`tests/node_compat/config.json\` and run \`deno task setup\` in \`tests/node_compat/runner\` dir instead.
`));
for (const test of missingTests) {
Expand Down Expand Up @@ -114,7 +114,7 @@ async function copyTests() {
// suite is the directory name after test/. For example, if the file is
// "node_compat/node/test/fixtures/policy/main.mjs"
// then suite is "fixtures/policy"
const suite = fragments.slice(fragments.indexOf("node_compat") + 3, -1)
const suite = fragments.slice(fragments.indexOf("node_compat") + 4, -1)
.join("/");
if (!hasEntry(entry.name, suite)) {
continue;
Expand All @@ -139,7 +139,7 @@ async function copyTests() {
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node ${NODE_VERSION}
// This file is automatically generated by \`tools/node_compat/setup.ts\`. Do not modify this file manually.
// This file is automatically generated by \`tests/node_compat/runner/setup.ts\`. Do not modify this file manually.
`),
);
Expand Down
1 change: 1 addition & 0 deletions tests/node_compat/runner/suite
Submodule suite added at b114fa
2 changes: 1 addition & 1 deletion tests/node_compat/test/common/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/common/countdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/common/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/common/duplexpair.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';
const { Duplex } = require('stream');
Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/common/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/common/hijackstdio.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/common/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

import { createRequire } from 'module';

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/common/tmpdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/fixtures/GH-1899-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

// Copyright Joyent, Inc. and other Node contributors.
//
Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/fixtures/a.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

// Copyright Joyent, Inc. and other Node contributors.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

// Copyright Joyent, Inc. and other Node contributors.
//
Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/fixtures/loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

var t = 1;
var k = 1;
Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/internet/test-dns-idna2008.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/internet/test-dns-lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';
const common = require('../common');
Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/internet/test-dns-regress-6244.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

// Copyright Joyent, Inc. and other Node contributors.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

// Copyright Joyent, Inc. and other Node contributors.
//
Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/parallel/test-assert-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';
const common = require('../common');
Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/parallel/test-assert-fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/parallel/test-bad-unicode.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

// Copyright Joyent, Inc. and other Node contributors.
//
Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/parallel/test-btoa-atob.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/test/parallel/test-buffer-alloc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 18.12.1
// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.

'use strict';
const common = require('../common');
Expand Down
Loading

0 comments on commit 2908589

Please sign in to comment.