This repository was archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegration.spec.ts
More file actions
44 lines (40 loc) · 2.07 KB
/
Copy pathintegration.spec.ts
File metadata and controls
44 lines (40 loc) · 2.07 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
35
36
37
38
39
40
41
42
43
44
import 'jasmine';
import { join } from 'path';
import { run } from './run';
import { promises } from 'fs';
import { deleteIfExists } from './delete-if-exists';
describe('integration', () =>
['simple', 'config-file', 'if_exists', 'custom_dockerfile', 'hoist', 'split-stages', 'npm_i_args', 'pre-stage']
.forEach(testCase =>
describe(testCase, () => {
afterAll(async function cleanup() {
await deleteIfExists(`./${testCase}/Dockerfile`);
await deleteIfExists(`./${testCase}/packages/a/package-slim.json`);
await deleteIfExists(`./${testCase}/packages/b/package-slim.json`);
await deleteIfExists(`./${testCase}/packages/c/package-slim.json`);
});
it('should start', async () => {
const packageJson: any = JSON.parse((await promises.readFile(join(__dirname, `./${testCase}/package.json`))).toString());
if (!packageJson.scripts || !packageJson.scripts['lerna-dockerize']) {
throw new Error(`Missing script lerna-dockerize for test-case ${testCase}!`);
}
const command = packageJson.scripts['lerna-dockerize'].split(' ');
command[0] = join(__dirname, '../../dist/index.js');
await run(
'node',
command,
join(__dirname, `./${testCase}`),
);
});
it('Dockerfile should match the expected Dockerfile', async () => {
const [
result,
expected,
] = await Promise.all([
promises.readFile(join(__dirname, `./${testCase}/Dockerfile`)).then(x => x.toString()),
promises.readFile(join(__dirname, `./${testCase}/Dockerfile.expected`)).then(x => x.toString()),
]);
expect(result).toEqual(expected);
});
})),
);