Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Move 'integration-test.ts' into 'resources' #3721

Merged
merged 1 commit into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"prettier": "prettier --cache --cache-strategy metadata --write --list-different .",
"prettier:check": "prettier --cache --cache-strategy metadata --check .",
"check:spelling": "cspell --cache --no-progress '**/*'",
"check:integrations": "npm run build:npm && npm run build:deno && mocha --full-trace integrationTests/*-test.ts",
"check:integrations": "npm run build:npm && npm run build:deno && mocha --full-trace resources/integration-test.ts",
"serve": "docusaurus serve --dir websiteDist/ --config website/docusaurus.config.cjs",
"start": "npm run build:website && npm run serve",
"build:website": "ts-node resources/build-docusaurus.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
import childProcess from 'node:child_process';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';

import { describe, it } from 'mocha';

function npm(args: ReadonlyArray<string>, options = {}): string {
const result = childProcess.spawnSync('npm', [...args], {
maxBuffer: 10 * 1024 * 1024, // 10MB
stdio: ['inherit', 'pipe', 'inherit'],
encoding: 'utf-8',
...options,
});
return result.stdout.toString().trimEnd();
}
import { localRepoPath, npm } from './utils.js';

describe('Integration Tests', () => {
const tmpDir = path.join(os.tmpdir(), 'graphql-js-integrationTmp');
fs.rmSync(tmpDir, { recursive: true, force: true });
fs.mkdirSync(tmpDir);

const distDir = path.resolve('./npmDist');
const distDir = localRepoPath('npmDist');
const archiveName = npm(['--quiet', 'pack', distDir], { cwd: tmpDir });
fs.renameSync(
path.join(tmpDir, archiveName),
path.join(tmpDir, 'graphql.tgz'),
);

function testOnNodeProject(projectName: string) {
const projectPath = new URL(projectName, import.meta.url).pathname;
const projectPath = localRepoPath('integrationTests', projectName);

const packageJSONPath = path.join(projectPath, 'package.json');
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8'));
Expand Down