Sitelet https://github.com/unjs/jiti/commit/1d86ca3
Skip to content

Commit 1d86ca3

Browse files
committed
test: add dependency tests
1 parent f99a1d7 commit 1d86ca3

13 files changed

Lines changed: 83 additions & 13 deletions

File tree

‎package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,17 @@
9393
"babel-plugin-parameter-decorator": "^1.0.16",
9494
"changelogen": "^0.5.7",
9595
"config": "^3.3.12",
96+
"consola": "^3.2.3",
9697
"destr": "^2.0.3",
9798
"escape-string-regexp": "^5.0.0",
9899
"eslint": "^9.11.0",
99100
"eslint-config-unjs": "^0.4.1",
100101
"estree-walker": "^3.0.3",
102+
"etag": "^1.8.1",
101103
"fast-glob": "^3.3.2",
104+
"mime": "^4.0.4",
102105
"mlly": "^1.7.1",
106+
"moment-timezone": "^0.5.45",
103107
"nano-jsx": "^0.1.0",
104108
"pathe": "^1.1.2",
105109
"pkg-types": "^1.2.0",

‎pnpm-lock.yaml‎

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/__snapshots__/fixtures.test.ts.snap‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ exports[`fixtures > circular > stdout 1`] = `"a b c"`;
66

77
exports[`fixtures > data-uri > stdout 1`] = `""`;
88

9+
exports[`fixtures > deps > stdout 1`] = `
10+
"npm:config: true
11+
npm:etag: true
12+
npm:mime: true
13+
npm:typescript: true
14+
npm:moment-timezone true"
15+
`;
16+
917
exports[`fixtures > env > stdout 1`] = `
1018
"process.env true
1119
process.env.TEST true
@@ -43,11 +51,6 @@ exports[`fixtures > esm > stdout 1`] = `
4351
}"
4452
`;
4553
46-
exports[`fixtures > exotic > stdout 1`] = `
47-
"Typescript: true
48-
Config: true"
49-
`;
50-
5154
exports[`fixtures > hashbang > stdout 1`] = `"1"`;
5255
5356
exports[`fixtures > import-map > stdout 1`] = `"{ alias: 'alias' }"`;

‎test/fixtures/deps/config.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// https://github.com/unjs/jiti/issues/56
2+
console.log("npm:config:", "getFilesOrder" in require("config/parser"));

‎test/fixtures/deps/consola.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import consola from "consola";
2+
3+
consola.log("npm:consola:", true);

‎test/fixtures/deps/etag.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @ts-ignore
2+
import etag from "etag";
3+
4+
console.log(
5+
"npm:etag:",
6+
etag("hello world") === `"b-Kq5sNclPz7QV2+lfQIuc6R7oRu0"`,
7+
);

‎test/fixtures/deps/index.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import "./config";
2+
import "./consola";
3+
import "./etag";
4+
import "./mime";
5+
import "./typescript";
6+
import "./moment";

‎test/fixtures/deps/mime.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import mime from "mime";
2+
3+
console.log("npm:mime:", mime.getType("txt") === "text/plain");

‎test/fixtures/deps/moment.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import momentTZ from "moment-timezone";
2+
3+
console.log(
4+
"npm:moment-timezone",
5+
// https://www.npmjs.com/package/moment-timezone
6+
momentTZ("2014-06-01T12:00:00Z").tz("America/Los_Angeles").format("ha z") ===
7+
"5am PDT",
8+
);

‎test/fixtures/deps/typescript.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import * as ts from "typescript";
2+
3+
console.log("npm:typescript:", "mapEntries" in ts);

0 commit comments

Comments
 (0)