-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
assertions.spec.ts
65 lines (41 loc) · 1.52 KB
/
assertions.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { Fixture, normalizeCommandOutput, normalizeEnvironment } from "@lerna/e2e-utils";
expect.addSnapshotSerializer({
serialize(str: string) {
return normalizeCommandOutput(normalizeEnvironment(str));
},
test(val: string) {
return val != null && typeof val === "string";
},
});
describe("lerna-run-nx-env-files", () => {
const fixtureRootPath = process.env.FIXTURE_ROOT_PATH;
let fixture: Fixture;
beforeAll(() => {
if (!fixtureRootPath) {
throw new Error("FIXTURE_ROOT_PATH environment variable is not set");
}
fixture = Fixture.fromExisting(process.env.E2E_ROOT, fixtureRootPath);
});
afterAll(() => fixture.destroy());
it("should log a value by default", async () => {
const output = await fixture.readOutput("log-env-var");
expect(output).toMatchInlineSnapshot(`
lerna notice cli v999.9.9-e2e.0
> package-X:log-env-var
> package-X@0.0.0 log-env-var
> echo $SOMETHING_IN_ENV_FILE
some_value_here
Lerna (powered by Nx) Successfully ran target log-env-var for project package-X
`);
});
it("should log an empty value when --load-env-files=false", async () => {
const output = await fixture.readOutput("log-env-var-load-env-files-false");
expect(output).toMatchInlineSnapshot(`
lerna notice cli v999.9.9-e2e.0
> package-X:log-env-var
> package-X@0.0.0 log-env-var
> echo $SOMETHING_IN_ENV_FILE
Lerna (powered by Nx) Successfully ran target log-env-var for project package-X
`);
});
});