summaryrefslogtreecommitdiff
path: root/tests/testdata/npm/cjs_sub_path
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-02-10 13:22:13 -0700
committerGitHub <noreply@github.com>2024-02-10 20:22:13 +0000
commitf5e46c9bf2f50d66a953fa133161fc829cecff06 (patch)
tree8faf2f5831c1c7b11d842cd9908d141082c869a5 /tests/testdata/npm/cjs_sub_path
parentd2477f780630a812bfd65e3987b70c0d309385bb (diff)
chore: move cli/tests/ -> tests/ (#22369)
This looks like a massive PR, but it's only a move from cli/tests -> tests, and updates of relative paths for files. This is the first step towards aggregate all of the integration test files under tests/, which will lead to a set of integration tests that can run without the CLI binary being built. While we could leave these tests under `cli`, it would require us to keep a more complex directory structure for the various test runners. In addition, we have a lot of complexity to ignore various test files in the `cli` project itself (cargo publish exclusion rules, autotests = false, etc). And finally, the `tests/` folder will eventually house the `test_ffi`, `test_napi` and other testing code, reducing the size of the root repo directory. For easier review, the extremely large and noisy "move" is in the first commit (with no changes -- just a move), while the remainder of the changes to actual files is in the second commit.
Diffstat (limited to 'tests/testdata/npm/cjs_sub_path')
-rw-r--r--tests/testdata/npm/cjs_sub_path/main.js21
-rw-r--r--tests/testdata/npm/cjs_sub_path/main.out35
2 files changed, 56 insertions, 0 deletions
diff --git a/tests/testdata/npm/cjs_sub_path/main.js b/tests/testdata/npm/cjs_sub_path/main.js
new file mode 100644
index 000000000..b71360959
--- /dev/null
+++ b/tests/testdata/npm/cjs_sub_path/main.js
@@ -0,0 +1,21 @@
+// this package will require a subpath like "ajv/dist/compile/codegen"
+// and also get the parent directory index.js file using require("..")
+import Ajv from "npm:ajv@~8.11";
+import addFormats from "npm:ajv-formats@2.1.1";
+import { expect } from "npm:chai@4.3";
+
+const ajv = new Ajv();
+addFormats(ajv);
+
+const schema = {
+ type: "string",
+ format: "date",
+ formatMinimum: "2016-02-06",
+ formatExclusiveMaximum: "2016-12-27",
+};
+const validate = ajv.compile(schema);
+
+expect(validate("2016-02-06")).to.be.true;
+expect(validate("2016-02-05")).to.be.false;
+
+console.log("Fini");
diff --git a/tests/testdata/npm/cjs_sub_path/main.out b/tests/testdata/npm/cjs_sub_path/main.out
new file mode 100644
index 000000000..34ec9d63f
--- /dev/null
+++ b/tests/testdata/npm/cjs_sub_path/main.out
@@ -0,0 +1,35 @@
+[UNORDERED_START]
+Download http://localhost:4545/npm/registry/ajv
+Download http://localhost:4545/npm/registry/ajv-formats
+Download http://localhost:4545/npm/registry/chai
+Download http://localhost:4545/npm/registry/fast-deep-equal
+Download http://localhost:4545/npm/registry/json-schema-traverse
+Download http://localhost:4545/npm/registry/require-from-string
+Download http://localhost:4545/npm/registry/uri-js
+Download http://localhost:4545/npm/registry/assertion-error
+Download http://localhost:4545/npm/registry/check-error
+Download http://localhost:4545/npm/registry/deep-eql
+Download http://localhost:4545/npm/registry/get-func-name
+Download http://localhost:4545/npm/registry/loupe
+Download http://localhost:4545/npm/registry/pathval
+Download http://localhost:4545/npm/registry/type-detect
+Download http://localhost:4545/npm/registry/punycode
+[UNORDERED_END]
+[UNORDERED_START]
+Download http://localhost:4545/npm/registry/ajv/ajv-8.11.0.tgz
+Download http://localhost:4545/npm/registry/ajv-formats/ajv-formats-2.1.1.tgz
+Download http://localhost:4545/npm/registry/assertion-error/assertion-error-1.1.0.tgz
+Download http://localhost:4545/npm/registry/chai/chai-4.3.6.tgz
+Download http://localhost:4545/npm/registry/check-error/check-error-1.0.2.tgz
+Download http://localhost:4545/npm/registry/deep-eql/deep-eql-3.0.1.tgz
+Download http://localhost:4545/npm/registry/fast-deep-equal/fast-deep-equal-3.1.3.tgz
+Download http://localhost:4545/npm/registry/get-func-name/get-func-name-2.0.0.tgz
+Download http://localhost:4545/npm/registry/json-schema-traverse/json-schema-traverse-1.0.0.tgz
+Download http://localhost:4545/npm/registry/loupe/loupe-2.3.4.tgz
+Download http://localhost:4545/npm/registry/pathval/pathval-1.1.1.tgz
+Download http://localhost:4545/npm/registry/punycode/punycode-2.1.1.tgz
+Download http://localhost:4545/npm/registry/require-from-string/require-from-string-2.0.2.tgz
+Download http://localhost:4545/npm/registry/type-detect/type-detect-4.0.8.tgz
+Download http://localhost:4545/npm/registry/uri-js/uri-js-4.4.1.tgz
+[UNORDERED_END]
+Fini