Files
directus/tests-blackbox/setup/teardown.ts
Pascal Jufer 47db8e5d2f Clean-up dependencies (#16481)
* Clean-up api

- Remove unnecessary deps
- rimraf -> del-cli

* Clean-up app

- bytes -> pretty-bytes
- Remove ms as we already have pretty-ms
- Remove other unnecessary deps
- Add storybook build to gitignore

* Clean-up drive packages

- Simplify cleanup scripts
- rimraf -> del-cli
- Remove unnecessary deps

* Clean-up schema

- Remove unnecessary dep (lodash)
- Replace 'npm-watch' with native watch mode

* Clean-up shared

- Remove unnecessary dep (c8, adding @vitest/coverage-c8 will be addressed in
  other PR)
- rimraf -> del-cli
- npm-run-all -> concurrently

* Clean-up root

- Add missing eslint-plugin-jest dep
- listr -> listr2

* Make build output a bit friendlier

* Remove cleanup scripts

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-11-18 17:02:41 +00:00

45 lines
1.1 KiB
TypeScript

/* eslint-disable no-console */
import { Listr } from 'listr2';
import vendors from '../common/get-dbs-to-test';
import config from '../common/config';
import { JestConfigWithTsJest } from 'ts-jest/dist/types';
import global from './global';
if (require.main === module) {
teardown(undefined, true);
}
export default async function teardown(jestConfig?: JestConfigWithTsJest, _isAfterWatch = false): Promise<void> {
if (jestConfig?.watch || jestConfig?.watchAll) return;
if (!process.env.TEST_LOCAL) {
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();
const directusNoCache = global.directusNoCache[vendor];
directusNoCache!.kill();
},
};
}),
{ concurrent: true, exitOnError: false }
);
},
},
]).run();
}
console.log('\n');
console.log(`👮‍♀️ Tests complete!\n`);
}