-
Notifications
You must be signed in to change notification settings - Fork 210
Expand file tree
/
Copy pathintegration.test.ts
More file actions
34 lines (29 loc) · 1.47 KB
/
Copy pathintegration.test.ts
File metadata and controls
34 lines (29 loc) · 1.47 KB
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
import fs from "fs-extra";
import {WriteStreamsMock} from "../../../src/write-streams.js";
import {handler} from "../../../src/handler.js";
import chalk from "chalk-template";
const cwd = "tests/test-cases/needs-parallel-matrix-artifacts";
afterAll(async () => {
await Promise.all(["aws", "gcp"].map(provider => fs.rm(`${cwd}/tag-${provider}.txt`, {force: true})));
});
test.concurrent("needs-parallel-matrix-artifacts cascades only the matching producer's artifacts to each consumer permutation", async () => {
const writeStreams = new WriteStreamsMock();
await handler({
cwd,
shellIsolation: true,
stateDir: ".gitlab-ci-local-needs-parallel-matrix-artifacts",
}, writeStreams);
// Positive: each test permutation reads its own producer's artifact via `cat tag-*.txt`.
expect(writeStreams.stdoutLines).toEqual(expect.arrayContaining([
chalk`{blueBright test: [aws] } {greenBright >} aws-data`,
chalk`{blueBright test: [gcp] } {greenBright >} gcp-data`,
]));
// Negative: the other matrix permutation's artifact must NOT have leaked into
// the consumer's working dir. If it did, `cat tag-*.txt` would emit both lines.
expect(writeStreams.stdoutLines).not.toEqual(expect.arrayContaining([
chalk`{blueBright test: [aws] } {greenBright >} gcp-data`,
]));
expect(writeStreams.stdoutLines).not.toEqual(expect.arrayContaining([
chalk`{blueBright test: [gcp] } {greenBright >} aws-data`,
]));
});