Skip to content

Commit

Permalink
integrationTests: switch tests to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed May 5, 2022
1 parent 5447189 commit 456c7cf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
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

0 comments on commit 456c7cf

Please sign in to comment.