@incanta/config 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/test/config-env/config-env.test.ts +0 -29
- package/test/config-env/default/thing.yaml +0 -1
- package/test/config-env/dev/thing.yaml +0 -1
- package/test/config-env/production/thing.yaml +0 -1
- package/test/config-json/config-json.test.ts +0 -23
- package/test/config-json/default/foo.json +0 -3
- package/test/config-json/default/goodbye/index.json +0 -8
- package/test/config-json/default/index.json +0 -3
- package/test/config-json5/config-json5.test.ts +0 -23
- package/test/config-json5/default/foo.json5 +0 -4
- package/test/config-json5/default/goodbye/index.json5 +0 -9
- package/test/config-json5/default/index.json5 +0 -4
- package/test/config-jsonc/config-jsonc.test.ts +0 -23
- package/test/config-jsonc/default/foo.jsonc +0 -4
- package/test/config-jsonc/default/goodbye/index.jsonc +0 -9
- package/test/config-jsonc/default/index.jsonc +0 -4
- package/test/config-local/config-local.test.ts +0 -13
- package/test/config-local/default/thing.yaml +0 -1
- package/test/config-local/local/thing.yaml +0 -1
- package/test/config-local/production/thing.yaml +0 -1
- package/test/config-multi/config-multi.test.ts +0 -23
- package/test/config-multi/default/foo.json +0 -3
- package/test/config-multi/default/goodbye/index.json5 +0 -9
- package/test/config-multi/default/index.yaml +0 -1
- package/test/config-override/config-override.test.ts +0 -13
- package/test/config-override/default/thing.yaml +0 -1
- package/test/config-override/local/thing.yaml +0 -1
- package/test/config-override/override.json +0 -5
- package/test/config-override/production/thing.yaml +0 -1
- package/test/config-yaml/config-yaml.test.ts +0 -23
- package/test/config-yaml/default/foo.yaml +0 -1
- package/test/config-yaml/default/goodbye/index.yaml +0 -5
- package/test/config-yaml/default/index.yaml +0 -1
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "@jest/globals";
|
|
2
|
-
import { Config } from "../../src/config";
|
|
3
|
-
import path from "path";
|
|
4
|
-
|
|
5
|
-
describe("Config with env folder", () => {
|
|
6
|
-
test("correctly loaded production directory", () => {
|
|
7
|
-
const config = new Config({
|
|
8
|
-
configDir: path.join(__dirname),
|
|
9
|
-
configEnv: "production",
|
|
10
|
-
});
|
|
11
|
-
expect(config.get<number>("thing.test")).toBe(2);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
test("correctly loaded dev directory", () => {
|
|
15
|
-
const config = new Config({
|
|
16
|
-
configDir: path.join(__dirname),
|
|
17
|
-
configEnv: "dev",
|
|
18
|
-
});
|
|
19
|
-
expect(config.get<number>("thing.test")).toBe(3);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test("correctly shows default value for invalid env directory", () => {
|
|
23
|
-
const config = new Config({
|
|
24
|
-
configDir: path.join(__dirname),
|
|
25
|
-
configEnv: "invalid",
|
|
26
|
-
});
|
|
27
|
-
expect(config.get<number>("thing.test")).toBe(1);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test: 1
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test: 3
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test: 2
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "@jest/globals";
|
|
2
|
-
import { Config } from "../../src/config";
|
|
3
|
-
import path from "path";
|
|
4
|
-
|
|
5
|
-
describe("Config with JSON files", () => {
|
|
6
|
-
const config = new Config({
|
|
7
|
-
configDir: path.join(__dirname),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test("correctly loaded default directory", () => {
|
|
11
|
-
expect(config.get<string>("hello")).toBe("world");
|
|
12
|
-
expect(config.get<number>("foo.bar")).toBe(42);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test("correctly loaded sub default directory", () => {
|
|
16
|
-
const arr = config.get<number[]>("goodbye.universe");
|
|
17
|
-
expect(arr.length).toBe(4);
|
|
18
|
-
expect(arr[0]).toBe(1);
|
|
19
|
-
expect(arr[1]).toBe(3);
|
|
20
|
-
expect(arr[2]).toBe(3);
|
|
21
|
-
expect(arr[3]).toBe(7);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "@jest/globals";
|
|
2
|
-
import { Config } from "../../src/config";
|
|
3
|
-
import path from "path";
|
|
4
|
-
|
|
5
|
-
describe("Config with JSON5 files", () => {
|
|
6
|
-
const config = new Config({
|
|
7
|
-
configDir: path.join(__dirname),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test("correctly loaded default directory", () => {
|
|
11
|
-
expect(config.get<string>("hello")).toBe("world");
|
|
12
|
-
expect(config.get<number>("foo.bar")).toBe(42);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test("correctly loaded sub default directory", () => {
|
|
16
|
-
const arr = config.get<number[]>("goodbye.universe");
|
|
17
|
-
expect(arr.length).toBe(4);
|
|
18
|
-
expect(arr[0]).toBe(1);
|
|
19
|
-
expect(arr[1]).toBe(3);
|
|
20
|
-
expect(arr[2]).toBe(3);
|
|
21
|
-
expect(arr[3]).toBe(7);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "@jest/globals";
|
|
2
|
-
import { Config } from "../../src/config";
|
|
3
|
-
import path from "path";
|
|
4
|
-
|
|
5
|
-
describe("Config with JSONC files", () => {
|
|
6
|
-
const config = new Config({
|
|
7
|
-
configDir: path.join(__dirname),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test("correctly loaded default directory", () => {
|
|
11
|
-
expect(config.get<string>("hello")).toBe("world");
|
|
12
|
-
expect(config.get<number>("foo.bar")).toBe(42);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test("correctly loaded sub default directory", () => {
|
|
16
|
-
const arr = config.get<number[]>("goodbye.universe");
|
|
17
|
-
expect(arr.length).toBe(4);
|
|
18
|
-
expect(arr[0]).toBe(1);
|
|
19
|
-
expect(arr[1]).toBe(3);
|
|
20
|
-
expect(arr[2]).toBe(3);
|
|
21
|
-
expect(arr[3]).toBe(7);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "@jest/globals";
|
|
2
|
-
import { Config } from "../../src/config";
|
|
3
|
-
import path from "path";
|
|
4
|
-
|
|
5
|
-
describe("Config with local folder", () => {
|
|
6
|
-
const config = new Config({
|
|
7
|
-
configDir: path.join(__dirname),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test("correctly loaded local directory", () => {
|
|
11
|
-
expect(config.get<number>("thing.test")).toBe(3);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test: 1
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test: 3
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test: 2
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "@jest/globals";
|
|
2
|
-
import { Config } from "../../src/config";
|
|
3
|
-
import path from "path";
|
|
4
|
-
|
|
5
|
-
describe("Config with mixed file types", () => {
|
|
6
|
-
const config = new Config({
|
|
7
|
-
configDir: path.join(__dirname),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test("correctly loaded default directory", () => {
|
|
11
|
-
expect(config.get<string>("hello")).toBe("world");
|
|
12
|
-
expect(config.get<number>("foo.bar")).toBe(42);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test("correctly loaded sub default directory", () => {
|
|
16
|
-
const arr = config.get<number[]>("goodbye.universe");
|
|
17
|
-
expect(arr.length).toBe(4);
|
|
18
|
-
expect(arr[0]).toBe(1);
|
|
19
|
-
expect(arr[1]).toBe(3);
|
|
20
|
-
expect(arr[2]).toBe(3);
|
|
21
|
-
expect(arr[3]).toBe(7);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
hello: world
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "@jest/globals";
|
|
2
|
-
import { Config } from "../../src/config";
|
|
3
|
-
import path from "path";
|
|
4
|
-
|
|
5
|
-
describe("Config with override folder", () => {
|
|
6
|
-
test("correctly loaded production directory", () => {
|
|
7
|
-
const config = new Config({
|
|
8
|
-
configDir: path.join(__dirname),
|
|
9
|
-
configEnv: "production",
|
|
10
|
-
});
|
|
11
|
-
expect(config.get<number>("thing.test")).toBe(4);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test: 1
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test: 3
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test: 2
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "@jest/globals";
|
|
2
|
-
import { Config } from "../../src/config";
|
|
3
|
-
import path from "path";
|
|
4
|
-
|
|
5
|
-
describe("Config with YAML files", () => {
|
|
6
|
-
const config = new Config({
|
|
7
|
-
configDir: path.join(__dirname),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test("correctly loaded default directory", () => {
|
|
11
|
-
expect(config.get<string>("hello")).toBe("world");
|
|
12
|
-
expect(config.get<number>("foo.bar")).toBe(42);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test("correctly loaded sub default directory", () => {
|
|
16
|
-
const arr = config.get<number[]>("goodbye.universe");
|
|
17
|
-
expect(arr.length).toBe(4);
|
|
18
|
-
expect(arr[0]).toBe(1);
|
|
19
|
-
expect(arr[1]).toBe(3);
|
|
20
|
-
expect(arr[2]).toBe(3);
|
|
21
|
-
expect(arr[3]).toBe(7);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bar: 42
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
hello: world
|