summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/npm/cjs_sub_path
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/testdata/npm/cjs_sub_path')
-rw-r--r--cli/tests/testdata/npm/cjs_sub_path/main.js21
-rw-r--r--cli/tests/testdata/npm/cjs_sub_path/main.out16
2 files changed, 37 insertions, 0 deletions
diff --git a/cli/tests/testdata/npm/cjs_sub_path/main.js b/cli/tests/testdata/npm/cjs_sub_path/main.js
new file mode 100644
index 000000000..ba3cce8db
--- /dev/null
+++ b/cli/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.2";
+
+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/cli/tests/testdata/npm/cjs_sub_path/main.out b/cli/tests/testdata/npm/cjs_sub_path/main.out
new file mode 100644
index 000000000..593b557dd
--- /dev/null
+++ b/cli/tests/testdata/npm/cjs_sub_path/main.out
@@ -0,0 +1,16 @@
+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
+Fini