-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathintegration-test.ts
More file actions
88 lines (73 loc) · 2.63 KB
/
integration-test.ts
File metadata and controls
88 lines (73 loc) · 2.63 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import fs from 'node:fs';
import { describe, it } from 'mocha';
import { localRepoPath, makeTmpDir, npm, readPackageJSON } from './utils.js';
// Keep these pinned to minimum supported runtime versions so integration
// checks continue to verify backward compatibility behavior.
const BUN_VERSION = '1.2.18';
const DENO_VERSION = '2.4.1';
describe('Integration Tests', () => {
const { tmpDirPath } = makeTmpDir('graphql-js-integrationTmp');
fs.cpSync(localRepoPath('integrationTests'), tmpDirPath(), {
recursive: true,
});
npm().run('build:npm');
const distDir = localRepoPath('npmDist');
const archiveName = npm({ cwd: tmpDirPath(), quiet: true }).pack(distDir);
fs.renameSync(tmpDirPath(archiveName), tmpDirPath('graphql.tgz'));
const esmDistDir = localRepoPath('npmEsmDist');
const archiveEsmName = npm({ cwd: tmpDirPath(), quiet: true }).pack(
esmDistDir,
);
fs.renameSync(tmpDirPath(archiveEsmName), tmpDirPath('graphql-esm.tgz'));
npm().run('build:deno');
fs.cpSync(localRepoPath('denoDist'), tmpDirPath('graphql-deno-dist'), {
recursive: true,
});
function testOnNodeProject(projectName: string) {
const projectPath = tmpDirPath(projectName);
const packageJSON = readPackageJSON(projectPath);
it(packageJSON.description, () => {
// TODO: figure out a way to run it with --ignore-scripts
npm({ cwd: projectPath, quiet: true }).install();
npm({
cwd: projectPath,
quiet: true,
env: {
...process.env,
BUN_VERSION,
DENO_VERSION,
},
}).run('test');
}).timeout(120000);
}
testOnNodeProject('ts');
testOnNodeProject('node');
testOnNodeProject('webpack');
// Tracing channel tests
testOnNodeProject('diagnostics');
// Conditional export tests
testOnNodeProject('conditions');
// Development mode tests
testOnNodeProject('dev-explicit');
testOnNodeProject('dev-node');
testOnNodeProject('dev-deno-with-deno-build');
testOnNodeProject('dev-deno-with-node-build');
testOnNodeProject('dev-bun');
testOnNodeProject('dev-webpack');
testOnNodeProject('dev-rspack');
testOnNodeProject('dev-rollup');
testOnNodeProject('dev-esbuild');
testOnNodeProject('dev-swc');
testOnNodeProject('dev-jest');
testOnNodeProject('dev-vitest');
// Production mode tests
testOnNodeProject('prod-node');
testOnNodeProject('prod-deno-with-deno-build');
testOnNodeProject('prod-deno-with-node-build');
testOnNodeProject('prod-bun');
testOnNodeProject('prod-webpack');
testOnNodeProject('prod-rspack');
testOnNodeProject('prod-rollup');
testOnNodeProject('prod-esbuild');
testOnNodeProject('prod-swc');
});