scaffolder-backend: fix loading of ESM-only module in test
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -38,7 +38,6 @@ import {
|
||||
mockCredentials,
|
||||
mockServices,
|
||||
} from '@backstage/backend-test-utils';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
@@ -48,6 +47,7 @@ describe('NunjucksWorkflowRunner', () => {
|
||||
let runner: NunjucksWorkflowRunner;
|
||||
let fakeActionHandler: jest.Mock;
|
||||
let fakeTaskLog: jest.Mock;
|
||||
let stripAnsi: typeof import('strip-ansi').default;
|
||||
|
||||
const mockDir = createMockDirectory();
|
||||
|
||||
@@ -92,9 +92,12 @@ describe('NunjucksWorkflowRunner', () => {
|
||||
);
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
mockDir.clear();
|
||||
|
||||
// This one is ESM-only
|
||||
stripAnsi = await import('strip-ansi').then(m => m.default);
|
||||
|
||||
jest.resetAllMocks();
|
||||
logger = mockServices.logger.mock();
|
||||
actionRegistry = new TemplateActionRegistry();
|
||||
|
||||
Reference in New Issue
Block a user