diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-08-20 11:31:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-20 11:31:33 -0400 |
commit | 87f80ff6be5e2a132b583a9c380fff5db3cb2b07 (patch) | |
tree | b2c43c9004b9ada204f3b5db7c221fa6322f026a /cli/tests/testdata/npm/cjs_sub_path/main.js | |
parent | 1ffbd561642d05a05e18ada764d50581dea779ef (diff) |
feat(unstable): initial support for npm specifiers (#15484)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/tests/testdata/npm/cjs_sub_path/main.js')
-rw-r--r-- | cli/tests/testdata/npm/cjs_sub_path/main.js | 21 |
1 files changed, 21 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"); |