Files
directus/tests/e2e/setup/teardown.ts
Oreille 7e10d2017e End-to-end tests refactor (#10968)
* Refactor e2e tests

* Only install root dependencies for lint step

* Fix dumbest error ever

* Pass process.env too to spawned subprocess

* Suppress npm package installation prompt

* Improve error handling

* Add new compose file for tests

* Avoid port conflict with remoted

* Update docker-compose.yml

* Add test docs

* Use current branch workflow files and simplify skips

* Fix workflow file

* Fix workflow file

* Try adding `.yml` extension to allow reference in `uses`

* Place workflow file in folders to allow reference in `uses`

* Requires more work than expected, reverting

* Update docs to use correct compose file

* Remove comment / unused code

* Run tests from main

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Jay Cammarano <jay.cammarano@gmail.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-01-13 16:32:45 -05:00

40 lines
913 B
TypeScript

/* eslint-disable no-console */
import Listr from 'listr';
import vendors from '../get-dbs-to-test';
import config from '../config';
import { GlobalConfigTsJest } from 'ts-jest/dist/types';
import global from './global';
if (require.main === module) {
teardown(undefined, true);
}
export default async function teardown(jestConfig?: GlobalConfigTsJest, _isAfterWatch = false): Promise<void> {
if (jestConfig?.watch || jestConfig?.watchAll) return;
await new Listr([
{
title: 'Stop Directus servers',
task: () => {
return new Listr(
vendors.map((vendor) => {
return {
title: config.names[vendor]!,
task: async () => {
const directus = global.directus[vendor];
directus!.kill();
},
};
}),
{ concurrent: true, exitOnError: false }
);
},
},
]).run();
console.log('\n');
console.log(`👮‍♀️ Tests complete!\n`);
}