Skip to content

Commit 2af34b2

Browse files
Fixed tests that were failing in GitHub Actions due to differences in environment variables
1 parent 17af799 commit 2af34b2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/specs/defaults.spec.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,18 @@ describe("defaults", () => {
144144

145145
describe("defaults.options", () => {
146146
it("should use the default options", () => {
147-
chaiExec.defaults.options = { env: { foo: "Hello", bar: "world" }};
147+
chaiExec.defaults.options = { env: { ...process.env, foo: "Hello", bar: "world" }};
148148
let cli = chaiExec("test/fixtures/bin/echo-env foo bar");
149149

150150
cli.command.should.equal("test/fixtures/bin/echo-env");
151151
cli.args.should.deep.equal(["foo", "bar"]);
152+
cli.stdout.should.equal("foo: Hello\nbar: world\n");
152153
cli.should.have.stdout("foo: Hello\nbar: world\n");
153154
});
154155

155156
it("should use the default command and options", () => {
156157
chaiExec.defaults.command = "test/fixtures/bin/echo-env";
157-
chaiExec.defaults.options = { env: { foo: "Hello", bar: "world" }};
158+
chaiExec.defaults.options = { env: { ...process.env, foo: "Hello", bar: "world" }};
158159
let cli = chaiExec("foo bar");
159160

160161
cli.command.should.equal("test/fixtures/bin/echo-env");
@@ -165,7 +166,7 @@ describe("defaults", () => {
165166
it("should use the default command, args, and options", () => {
166167
chaiExec.defaults.command = "test/fixtures/bin/echo-env";
167168
chaiExec.defaults.args = "foo bar";
168-
chaiExec.defaults.options = { env: { foo: "Hello", bar: "world" }};
169+
chaiExec.defaults.options = { env: { ...process.env, foo: "Hello", bar: "world" }};
169170
let cli = chaiExec();
170171

171172
cli.command.should.equal("test/fixtures/bin/echo-env");
@@ -175,7 +176,7 @@ describe("defaults", () => {
175176

176177
it("should append args to the default args, and options", () => {
177178
chaiExec.defaults.args = ["foo", "bar"];
178-
chaiExec.defaults.options = { env: { foo: "Hello", bar: "world", biz: "AAA", baz: "BBB" }};
179+
chaiExec.defaults.options = { env: { ...process.env, foo: "Hello", bar: "world", biz: "AAA", baz: "BBB" }};
179180
let cli = chaiExec(["test/fixtures/bin/echo-env", "biz", "baz"]);
180181

181182
cli.command.should.equal("test/fixtures/bin/echo-env");
@@ -186,7 +187,7 @@ describe("defaults", () => {
186187
it("should append args to the default command, args, and options", () => {
187188
chaiExec.defaults.command = "test/fixtures/bin/echo-env";
188189
chaiExec.defaults.args = "foo bar";
189-
chaiExec.defaults.options = { env: { foo: "Hello", bar: "world", biz: "AAA", baz: "BBB" }};
190+
chaiExec.defaults.options = { env: { ...process.env, foo: "Hello", bar: "world", biz: "AAA", baz: "BBB" }};
190191
let cli = chaiExec("biz baz");
191192

192193
cli.command.should.equal("test/fixtures/bin/echo-env");

0 commit comments

Comments
 (0)