Skip to content

Commit 592ef22

Browse files
committed
6.2 gitignore the .env
1 parent 20b3080 commit 592ef22

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/env.test.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const assert = require("assert");
22
const {
3-
promises: { stat },
3+
promises: { stat, readFile },
44
F_OK
55
} = require("fs");
66
const path = require("path");
@@ -17,4 +17,17 @@ describe(".env", () => {
1717
});
1818
assert.ok(hasEnv);
1919
});
20+
// 6.2
21+
it("should be ignored in the .gitignore file", async () => {
22+
const gitIgnorePath = path.join(process.cwd(), ".gitignore");
23+
const gitIgnoreFile = await readFile(gitIgnorePath, "utf8");
24+
const lines = gitIgnoreFile.split("\n");
25+
let hasMatch = false;
26+
for (const line of lines) {
27+
if (line.match(/^.env/)) {
28+
hasMatch = true;
29+
}
30+
}
31+
assert.ok(hasMatch, ".env is not added to the .gitignore file");
32+
});
2033
});

0 commit comments

Comments
 (0)