@01/env 2.0.1 → 2.0.4

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/junit.xml ADDED
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuites name="jest tests" tests="17" failures="0" time="2.932">
3
+ <testsuite name="env test suite" errors="0" failures="0" skipped="0" timestamp="2022-04-12T22:11:36" time="2.359" tests="17">
4
+ <testcase classname="env test suite When reading string env variable Should return string" name="env test suite When reading string env variable Should return string" time="0.002">
5
+ </testcase>
6
+ <testcase classname="env test suite When reading undefined string env variable Should return default value" name="env test suite When reading undefined string env variable Should return default value" time="0.001">
7
+ </testcase>
8
+ <testcase classname="env test suite When reading undefined string env variable Should return undefined if there is no default value" name="env test suite When reading undefined string env variable Should return undefined if there is no default value" time="0">
9
+ </testcase>
10
+ <testcase classname="env test suite When reading int env variable Should return int" name="env test suite When reading int env variable Should return int" time="0">
11
+ </testcase>
12
+ <testcase classname="env test suite When reading undefined int env variable Should return default value" name="env test suite When reading undefined int env variable Should return default value" time="0.001">
13
+ </testcase>
14
+ <testcase classname="env test suite When reading undefined int env variable Should return undefined if there is no default value" name="env test suite When reading undefined int env variable Should return undefined if there is no default value" time="0">
15
+ </testcase>
16
+ <testcase classname="env test suite When reading float env variable Should return float" name="env test suite When reading float env variable Should return float" time="0">
17
+ </testcase>
18
+ <testcase classname="env test suite When reading undefined float env variable Should return default value" name="env test suite When reading undefined float env variable Should return default value" time="0">
19
+ </testcase>
20
+ <testcase classname="env test suite When reading undefined float env variable Should return undefined if there is no default value" name="env test suite When reading undefined float env variable Should return undefined if there is no default value" time="0">
21
+ </testcase>
22
+ <testcase classname="env test suite When reading boolean:true env variable Should return boolean:true" name="env test suite When reading boolean:true env variable Should return boolean:true" time="0.001">
23
+ </testcase>
24
+ <testcase classname="env test suite When reading boolean:false env variable Should return boolean:false" name="env test suite When reading boolean:false env variable Should return boolean:false" time="0">
25
+ </testcase>
26
+ <testcase classname="env test suite When reading undefined float env variable Should return default value" name="env test suite When reading undefined float env variable Should return default value" time="0">
27
+ </testcase>
28
+ <testcase classname="env test suite When reading undefined float env variable Should return undefined if there is no default value" name="env test suite When reading undefined float env variable Should return undefined if there is no default value" time="0.001">
29
+ </testcase>
30
+ <testcase classname="env test suite envJson test suite When reading valid json env variable Should return parsed json value" name="env test suite envJson test suite When reading valid json env variable Should return parsed json value" time="0.001">
31
+ </testcase>
32
+ <testcase classname="env test suite envJson test suite When reading invalid json env variable Should return parsed json value" name="env test suite envJson test suite When reading invalid json env variable Should return parsed json value" time="0">
33
+ </testcase>
34
+ <testcase classname="env test suite envJson test suite When reading undefined json env variable Should return default value" name="env test suite envJson test suite When reading undefined json env variable Should return default value" time="0">
35
+ </testcase>
36
+ <testcase classname="env test suite envJson test suite When reading undefined json env variable Should return undefined if there is no default value" name="env test suite envJson test suite When reading undefined json env variable Should return undefined if there is no default value" time="0">
37
+ </testcase>
38
+ </testsuite>
39
+ </testsuites>
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@01/env",
3
- "version": "2.0.1",
3
+ "version": "2.0.4",
4
4
  "description": "Nodejs env utils",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
- "repository": "git@github.com:01alchemist/web-servicelib-.git",
7
+ "repository": "git@github.com:01alchemist/web-service-lib.git",
8
8
  "author": "Nidin Vinayakan <01@01alchemist.com>",
9
9
  "keywords": [
10
10
  "nodejs",
@@ -19,7 +19,10 @@
19
19
  "build": "NODE_ENV=production node ../../scripts/webpack.js --config=webpack.config.ts",
20
20
  "precommit": "lint-staged",
21
21
  "test": "NODE_ENV=test jest --ci --config=./jest.json --coverage --reporters=default --reporters=jest-junit",
22
- "publish": "npm publish --access public"
22
+ "tdd": "NODE_ENV=test jest --config=./jest.json --coverage --watch",
23
+ "link": "yarn link",
24
+ "unlink": "yarn unlink",
25
+ "clean": "rm -rf node_modules"
23
26
  },
24
27
  "lint-staged": {
25
28
  "*.ts": [
@@ -32,8 +35,11 @@
32
35
  "tslib": "2.0.1"
33
36
  },
34
37
  "devDependencies": {
35
- "@01/core-utils": "^1.0.2",
36
- "@types/node": "14.11.2"
38
+ "@01/core-utils": "^2.0.4",
39
+ "@types/node": "14.11.2",
40
+ "jest-junit": "11.1.0",
41
+ "nodemon": "2.0.4",
42
+ "prettier": "2.1.2"
37
43
  },
38
- "gitHead": "0bcce8606dca97ebe097828c94723a59cd766df4"
44
+ "gitHead": "e49613c372a1ec0bf678cec39e75febe23001164"
39
45
  }
package/src/env.spec.ts CHANGED
@@ -13,6 +13,11 @@ describe("env test suite", () => {
13
13
  delete process.env.STRING_VALUE;
14
14
  expect(env("STRING_VALUE", "DEFAULT_VALUE")).toBe("DEFAULT_VALUE");
15
15
  });
16
+
17
+ it("Should return undefined if there is no default value", () => {
18
+ delete process.env.STRING_VALUE;
19
+ expect(env("STRING_VALUE")).toBeUndefined();
20
+ });
16
21
  });
17
22
 
18
23
  describe("When reading int env variable", () => {
@@ -27,6 +32,11 @@ describe("env test suite", () => {
27
32
  delete process.env.INT_VALUE;
28
33
  expect(envInt("INT_VALUE", 1)).toBe(1);
29
34
  });
35
+
36
+ it("Should return undefined if there is no default value", () => {
37
+ delete process.env.INT_VALUE;
38
+ expect(envInt("INT_VALUE")).toBeUndefined();
39
+ });
30
40
  });
31
41
 
32
42
  describe("When reading float env variable", () => {
@@ -41,6 +51,11 @@ describe("env test suite", () => {
41
51
  delete process.env.FLOAT_VALUE;
42
52
  expect(envFloat("FLOAT_VALUE", 1.5)).toBe(1.5);
43
53
  });
54
+
55
+ it("Should return undefined if there is no default value", () => {
56
+ delete process.env.FLOAT_VALUE;
57
+ expect(envFloat("FLOAT_VALUE")).toBeUndefined();
58
+ });
44
59
  });
45
60
 
46
61
  describe("When reading boolean:true env variable", () => {
@@ -62,6 +77,11 @@ describe("env test suite", () => {
62
77
  delete process.env.BOOLEAN_VALUE;
63
78
  expect(envBoolean("BOOLEAN_VALUE", true)).toBe(true);
64
79
  });
80
+
81
+ it("Should return undefined if there is no default value", () => {
82
+ delete process.env.BOOLEAN_VALUE;
83
+ expect(envBoolean("BOOLEAN_VALUE")).toBeUndefined();
84
+ });
65
85
  });
66
86
 
67
87
  describe("envJson test suite", () => {
@@ -81,10 +101,10 @@ describe("env test suite", () => {
81
101
  it("Should return default value", () => {
82
102
  delete process.env.JSON_VALUE;
83
103
  expect(envJson("JSON_VALUE", { value: true })).toEqual({
84
- value: true
104
+ value: true,
85
105
  });
86
106
  });
87
- it("Should return undefined if no default value", () => {
107
+ it("Should return undefined if there is no default value", () => {
88
108
  delete process.env.JSON_VALUE;
89
109
  expect(envJson("JSON_VALUE")).toBeUndefined();
90
110
  });
package/tsconfig.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
- "include": ["src", "types"],
2
+ "include": ["src"],
3
3
  "compilerOptions": {
4
- "target": "es2019",
5
- "module": "commonjs",
6
- "lib": ["es2019"],
4
+ "module": "CommonJS",
5
+ "target": "es2015",
6
+ "lib": ["dom", "esnext"],
7
7
  "importHelpers": true,
8
8
  "declaration": true,
9
9
  "declarationMap": true,
@@ -24,7 +24,7 @@
24
24
  "baseUrl": "./",
25
25
  "outDir": "./dist",
26
26
  "paths": {
27
- "*": ["src/*", "node_modules/*"]
27
+ "~/*": ["./src/*"]
28
28
  },
29
29
  "jsx": "react",
30
30
  "esModuleInterop": true