[jest/configs] fix checks for nested packages (#130583)

This commit is contained in:
Spencer 2022-04-19 15:11:12 -05:00 committed by GitHub
parent 2a7b219fbb
commit 1264fc9203
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 15 deletions

View file

@ -19,7 +19,7 @@ import { REPO_ROOT } from '@kbn/utils';
* eg. src/vis_editors => would find a package at src/vis_editors/foo/package.json
* src/vis_editors/* => would find a package at src/vis_editors/foo/bar/package.json
*/
export const BAZEL_PACKAGE_DIRS = ['packages', 'packages/shared-ux', 'packages/shared-ux/*'];
export const BAZEL_PACKAGE_DIRS = ['packages', 'packages/shared-ux/*'];
/**
* Resolve all the BAZEL_PACKAGE_DIRS to absolute paths

View file

@ -24,7 +24,8 @@ export class JestConfigs {
constructor(cwd: string, roots: string[]) {
this.cwd = cwd;
this.roots = roots;
// sort roots by length so when we use `file.startsWith()` we will find the most specific root first
this.roots = roots.slice().sort((a, b) => b.length - a.length);
}
async files(type: 'unit' | 'integration') {

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/shared-ux'],
};