Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
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
12 changes: 11 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,11 @@ rules:
wrap-regex: off
yield-star-spacing: off

ignorePatterns: 'integrationTests/ts/*.ts'
overrides:
- files: '**/*.ts'
parser: '@typescript-eslint/parser'
parserOptions:
tsconfigRootDir: './types/'
project: ['tsconfig.json']
plugins:
- '@typescript-eslint'
Expand Down Expand Up @@ -633,6 +633,16 @@ overrides:
import/no-extraneous-dependencies: [error, { devDependencies: true }]
import/no-nodejs-modules: off
no-sync: off
- files: 'integrationTests/**'
parserOptions:
sourceType: script
rules:
node/no-unpublished-import: off
node/no-unpublished-require: off
node/no-sync: off
import/no-extraneous-dependencies: [error, { devDependencies: true }]
import/no-nodejs-modules: off
no-console: off
- files: 'resources/**'
parserOptions:
sourceType: script
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,29 @@ jobs:
- name: Lint Flow
run: npm run check

integrationTests:
name: Run integration tests
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}

# We install bunch of packages during integration tests without locking them
# so we skip cache action to not pollute cache for other jobs.
- name: Install Dependencies
run: npm ci

- name: Build NPM package
run: npm run build

- name: Run Integration Tests
run: npm run check:integrations

coverage:
name: Measure test coverage
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
npm-debug.log

dist
integrationTmp
node_modules
coverage
1 change: 1 addition & 0 deletions integrationTests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TBD
30 changes: 30 additions & 0 deletions integrationTests/integration-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// @noflow

'use strict';

const fs = require('fs');
const path = require('path');
const childProcess = require('child_process');

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

function exec(command, options = {}) {
return childProcess.execSync(command, {
stdio: 'inherit',
...options,
});
}

describe('Integration Tests', () => {
const tmpDir = path.resolve('./integrationTmp');
fs.rmdirSync(tmpDir, { recursive: true });
fs.mkdirSync(tmpDir);

it('Should compile with all supported TS versions', () => {
exec(`cp -R ${path.join(__dirname, 'ts')} ${tmpDir}`);

const cwd = path.join(tmpDir, 'ts');
exec('npm install --silent', { cwd });
exec('npm test', { cwd });
}).timeout(40000);
});
File renamed without changes.
19 changes: 19 additions & 0 deletions integrationTests/ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"scripts": {
"test": "node test.js"
},
"dependencies": {
"@types/node": "14.0.13",
"express-graphql": "file:../../dist",
"typescript-3.0": "npm:[email protected]",
"typescript-3.1": "npm:[email protected]",
"typescript-3.2": "npm:[email protected]",
"typescript-3.3": "npm:[email protected]",
"typescript-3.4": "npm:[email protected]",
"typescript-3.5": "npm:[email protected]",
"typescript-3.6": "npm:[email protected]",
"typescript-3.7": "npm:[email protected]",
"typescript-3.8": "npm:[email protected]",
"typescript-3.9": "npm:[email protected]"
}
}
19 changes: 19 additions & 0 deletions integrationTests/ts/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// @noflow

'use strict';

const path = require('path');
const childProcess = require('child_process');

const { dependencies } = require('./package.json');

const tsVersions = Object.keys(dependencies)
.filter((pkg) => pkg.startsWith('typescript-'))
.sort((a, b) => b.localeCompare(a));

for (const version of tsVersions) {
console.log(`Testing on ${version} ...`);

const tscPath = path.join(__dirname, 'node_modules', version, 'bin/tsc');
childProcess.execSync(tscPath, { stdio: 'inherit' });
}
8 changes: 8 additions & 0 deletions integrationTests/ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6", "esnext.asynciterable"],
"strict": true,
"noEmit": true
}
}
Loading