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

integrationTests: switch tests to TS #3558

Merged
merged 1 commit into from
May 5, 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
6 changes: 5 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ rules:
simple-import-sort/imports:
- error
- groups:
# Node.js builtin modules
- ["^node:\\w"]

# Packages.
# Things that start with a letter (or digit or underscore), or `@` followed by a letter.
- ["^@?\\w"]
Expand Down Expand Up @@ -668,8 +671,9 @@ overrides:
node: true
rules:
node/no-sync: off
node/no-unpublished-require: [error, { allowModules: ['mocha'] }]
node/no-unpublished-import: [error, { allowModules: ['mocha'] }]
import/no-extraneous-dependencies: [error, { devDependencies: true }]
import/no-namespace: off
import/no-nodejs-modules: off
- files: 'integrationTests/*/**'
parserOptions:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
'use strict';
import * as childProcess from 'node:child_process';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';

const os = require('os');
const fs = require('fs');
const path = require('path');
const childProcess = require('child_process');
import { describe, it } from 'mocha';

const { describe, it } = require('mocha');

function exec(command, options = {}) {
function exec(command: string, options = {}) {
const output = childProcess.execSync(command, {
encoding: 'utf-8',
...options,
});
return output && output.trimEnd();
return output?.trimEnd();
}

describe('Integration Tests', () => {
Expand All @@ -27,7 +25,7 @@ describe('Integration Tests', () => {
path.join(tmpDir, 'graphql.tgz'),
);

function testOnNodeProject(projectName) {
function testOnNodeProject(projectName: string) {
const projectPath = path.join(__dirname, projectName);

const packageJSONPath = path.join(projectPath, 'package.json');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"prettier": "prettier --write --list-different .",
"prettier:check": "prettier --check .",
"check:spelling": "cspell --cache --no-progress '**/*'",
"check:integrations": "npm run build:npm && npm run build:deno && mocha --full-trace integrationTests/*-test.js",
"check:integrations": "npm run build:npm && npm run build:deno && mocha --full-trace integrationTests/*-test.ts",
"start": "DOCUSAURUS_GENERATED_FILES_DIR_NAME=\"$(pwd)/.docusaurus\" docusaurus start ./website",
"build:website": "DOCUSAURUS_GENERATED_FILES_DIR_NAME=\"$(pwd)/.docusaurus\" docusaurus build --out-dir=\"$(pwd)/websiteDist\" ./website",
"build:npm": "node resources/build-npm.js",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"include": ["src/**/*"],
"include": ["src/**/*", "integrationTests/*"],
"compilerOptions": {
"lib": ["es2020"],
"target": "es2020",
Expand Down