Skip to content

Commit 5b431aa

Browse files
Merge pull request #2324 from markscott-ms/fix/2323
2 parents 6761945 + 2ec7ab7 commit 5b431aa

6 files changed

Lines changed: 59 additions & 5 deletions

File tree

cli/test_fixtures/getting-started/STEP-2/website/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
"react": "^18.0.0",
2121
"react-dom": "^18.0.0",
2222
"unist-util-visit": "^5.0.0"
23+
},
24+
"overrides": {
25+
"@mermaid-js/layout-elk": "^0.2.0",
26+
"webpackbar": "^7.0.0"
2327
}
24-
}
28+
}

cli/test_fixtures/getting-started/STEP-3/website/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
"react": "^18.0.0",
2121
"react-dom": "^18.0.0",
2222
"unist-util-visit": "^5.0.0"
23+
},
24+
"overrides": {
25+
"@mermaid-js/layout-elk": "^0.2.0",
26+
"webpackbar": "^7.0.0"
2327
}
24-
}
28+
}

shared/src/docify/template-bundles/docusaurus/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
"react": "^18.0.0",
2121
"react-dom": "^18.0.0",
2222
"unist-util-visit": "^5.0.0"
23+
},
24+
"overrides": {
25+
"@mermaid-js/layout-elk": "^0.2.0",
26+
"webpackbar": "^7.0.0"
2327
}
24-
}
28+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { describe, it, expect, afterAll } from 'vitest';
2+
import { copyFileSync, mkdtempSync, rmSync } from 'fs';
3+
import { join } from 'path';
4+
import { tmpdir } from 'os';
5+
import { spawn } from 'child_process';
6+
7+
const TEMPLATE_PACKAGE_JSON = join(__dirname, 'package.json');
8+
9+
// The purpose of this test is to ensure that the docusaurus template bundle's dependencies can be
10+
// resolved. This is a long-running test because it involves "npm install", which can take some time.
11+
//
12+
// Without this test, we might not discover peer dependency conflicts until after a release is produced
13+
// and a user tries to use the template bundle.
14+
describe('docusaurus template bundle dependencies', () => {
15+
const tmpDir = mkdtempSync(join(tmpdir(), 'calm-docusaurus-'));
16+
17+
afterAll(() => {
18+
rmSync(tmpDir, { recursive: true, force: true });
19+
});
20+
21+
it('should resolve without peer dependency conflicts (long running test)', async () => {
22+
copyFileSync(TEMPLATE_PACKAGE_JSON, join(tmpDir, 'package.json'));
23+
24+
const exitCode = await new Promise<number>((resolve, reject) => {
25+
const stderr: string[] = [];
26+
const proc = spawn('npm', ['install', '--package-lock-only', '--prefix', tmpDir]);
27+
proc.stderr?.on('data', (chunk: Buffer) => stderr.push(chunk.toString()));
28+
proc.on('close', (code) => resolve(code ?? 1));
29+
proc.on('error', reject);
30+
});
31+
32+
expect(exitCode).toBe(0);
33+
}, 120_000);
34+
});

shared/test_fixtures/docify/workshop/expected-output/non-secure/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
"react": "^18.0.0",
2121
"react-dom": "^18.0.0",
2222
"unist-util-visit": "^5.0.0"
23+
},
24+
"overrides": {
25+
"@mermaid-js/layout-elk": "^0.2.0",
26+
"webpackbar": "^7.0.0"
2327
}
24-
}
28+
}

shared/test_fixtures/docify/workshop/expected-output/secure/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
"react": "^18.0.0",
2121
"react-dom": "^18.0.0",
2222
"unist-util-visit": "^5.0.0"
23+
},
24+
"overrides": {
25+
"@mermaid-js/layout-elk": "^0.2.0",
26+
"webpackbar": "^7.0.0"
2327
}
24-
}
28+
}

0 commit comments

Comments
 (0)